Nul*_*uli 7 c++ filesystems boost
码:
boost::filesystem::path config_folder(Config::CONFIG_FOLDER_NAME);
if( !(boost::filesystem::exists(config_folder)))
{
std::cout << "Network Config Directory not found...\n";
std::cout << "Creating folder called " << Config::CONFIG_FOLDER_NAME << "\n";
boost::filesystem::create_directory(config_folder);
}
if( !(boost::filesystem::exists(boost::format("%s/%s") % config_folder % Config::fmap[Config::current_hash_function]));
{
std::cout << "This hash has not been configure before...\n";
std::cout << "Creating folder called " << Config::fmap[Config::current_hash_function] << "\n";
boost::filesystem::create_directory(boost::format("%s/%s") % config_folder % Config::fmap[Config::current_hash_function]);
}
Run Code Online (Sandbox Code Playgroud)
因此,首先,如果config文件夹不存在,请创建它.(此部分有效)接下来,检查current_hash_function文件夹是否存在,如果不存在,请创建它.(这部分不起作用)
我得到的错误;
src/neural_networks/shared.cpp:41: error: no matching function for call to ‘exists(boost::basic_format<char, std::char_traits<char>, std::allocator<char> >&)’
Run Code Online (Sandbox Code Playgroud)
之所以我在fs中执行boost格式:exists check,是因为我不知道如何创建2级深度的路径
Rob*_*edy 10
该/
操作被重载来连接path
的对象.无需显式字符串格式化,也无需担心特定于平台的路径分隔符.
if(!(boost::filesystem::exists(config_folder / Config::fmap[Config::current_hash_function]));
Run Code Online (Sandbox Code Playgroud)
std::string
只要另一个是a,操作数就可以是path
.
归档时间: |
|
查看次数: |
10619 次 |
最近记录: |