C++ 从 boost::filesystem 创建目录成功,但是没有创建目录
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8388005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
create directory from boost::filesystem succeeds, however no dir is created
提问by Tony The Lion
I have the following code, and although the call to boost::filesystem::create_directory
returns true
, I see no directory created in my project folder.
我有以下代码,虽然调用了boost::filesystem::create_directory
Returns true
,但我没有看到在我的项目文件夹中创建了目录。
What could be the reason for this?
这可能是什么原因?
boost::filesystem::path dir("newdir");
if (boost::filesystem::create_directory(dir))
std::cout << "Success" << "\n";
I'm using VS2008 and Win7 Home Premium.
我使用的是 VS2008 和 Win7 Home Premium。
采纳答案by parapura rajkumar
You could be suffering from folder virtualization. Also try creating a directory with the full path so that you are not affected by whatever current application directoryis
您可能正在遭受文件夹虚拟化的困扰。还可以尝试使用完整路径创建一个目录,这样您就不会受到当前应用程序目录的影响
回答by endian
Could you be looking in the wrong place for it? A quick call to cout << current_path().string() << endl;
will show you where your directory is being created.
你是不是找错地方了?快速调用cout << current_path().string() << endl;
将显示您的目录的创建位置。