本文整理汇总了C++中openstudio::makeParentFolder方法的典型用法代码示例。如果您正苦于以下问题:C++ openstudio::makeParentFolder方法的具体用法?C++ openstudio::makeParentFolder怎么用?C++ openstudio::makeParentFolder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openstudio
的用法示例。
在下文中一共展示了openstudio::makeParentFolder方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resourcesPath
TEST_F(CoreFixture, Path_MakeParentFolder)
{
// path to directory
// add one folder
path p = resourcesPath()/toPath("energyplus/5ZoneAirCooled/MyTestFolder/");
EXPECT_FALSE(boost::filesystem::is_directory(p));
EXPECT_FALSE(boost::filesystem::exists(p));
EXPECT_TRUE(makeParentFolder(p));
EXPECT_TRUE(boost::filesystem::is_directory(p));
EXPECT_TRUE(boost::filesystem::exists(p));
EXPECT_EQ(static_cast<unsigned>(1),boost::filesystem::remove_all(p));
// path to file
// add parent folder
p = resourcesPath()/toPath("energyplus/5ZoneAirCooled/MyTestFolder/in.idf");
EXPECT_FALSE(boost::filesystem::is_directory(p.parent_path()));
EXPECT_FALSE(boost::filesystem::exists(p.parent_path()));
EXPECT_FALSE(boost::filesystem::is_regular_file(p));
EXPECT_TRUE(makeParentFolder(p));
EXPECT_TRUE(boost::filesystem::is_directory(p.parent_path()));
EXPECT_TRUE(boost::filesystem::exists(p.parent_path()));
EXPECT_FALSE(boost::filesystem::is_regular_file(p));
EXPECT_EQ(static_cast<unsigned>(1),boost::filesystem::remove_all(p.parent_path()));
// path to directory/directory
// do not add any folders
p = resourcesPath()/toPath("energyplus/5ZoneAirCooled/MyTestFolder1/MyTestFolder2/MyTestFolder3/");
EXPECT_FALSE(boost::filesystem::is_directory(p));
EXPECT_FALSE(boost::filesystem::exists(p));
EXPECT_FALSE(makeParentFolder(p));
EXPECT_FALSE(boost::filesystem::is_directory(p));
EXPECT_FALSE(boost::filesystem::exists(p));
// path to directory/directory
// add folders recursively
p = resourcesPath()/toPath("energyplus/5ZoneAirCooled/MyTestFolder1/MyTestFolder2/MyTestFolder3/");
EXPECT_FALSE(boost::filesystem::is_directory(p));
EXPECT_TRUE(makeParentFolder(p,path(),true));
EXPECT_TRUE(boost::filesystem::is_directory(p));
EXPECT_EQ(static_cast<unsigned>(3),boost::filesystem::remove_all(p.parent_path().parent_path().parent_path()));
// path to directory/directory/file
// use base
// add folders recursively
p = toPath("energyplus/5ZoneAirCooled/MyTestFolder1/MyTestFolder2/MyTestFolder3/in.idf");
path base = resourcesPath();
path tmp = base/p;
EXPECT_FALSE(boost::filesystem::is_directory(tmp.parent_path()));
EXPECT_FALSE(boost::filesystem::is_regular_file(tmp));
EXPECT_TRUE(makeParentFolder(p,base,true));
EXPECT_TRUE(boost::filesystem::is_directory(tmp.parent_path()));
EXPECT_FALSE(boost::filesystem::is_regular_file(tmp));
EXPECT_EQ(static_cast<unsigned>(3),boost::filesystem::remove_all(tmp.parent_path().parent_path().parent_path()));
}