开发者

boost::filesystem::create_directories(); adding folders to strange locations

I'm using boost to create a directory to place some temp files in.

int main( int argc, char* argv[] )
{
    std::cout << "Current Dir: " << argv[0] << std::endl;
    boost::filesystem::create_directories( "TempFolder" );
    return 0;
}

Now if double click the exe, the folder "TempFolder" is created in the same directory as the exe, which I expect. However if I now drag a file onto the exe the folder is created in "C:\Documents and Settings\0xC0DEFACE" which i certainly was not expecting.

Seeing my app hasnt changed, and the dir being printed out hasnt changed, and my app is currently ignoring passed strings, wh开发者_运维百科y is the folder now being created in a new directory?

im running windows XP, with VS9 and am using boost 1.39.


I think it's because of the way you 'execute' your binary.

In the first case you double click it and it will run in 'current' directory.

In the second case you drop file on it which causes different action by Windows to execute your binary. In the second case the binary runs in your 'home' directory I believe.

It's the difference between how Windows executes your application.

I've had similar issues when dropping files on my executable.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜