本文整理汇总了C++中FileHelper::TempDir方法的典型用法代码示例。如果您正苦于以下问题:C++ FileHelper::TempDir方法的具体用法?C++ FileHelper::TempDir怎么用?C++ FileHelper::TempDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHelper
的用法示例。
在下文中一共展示了FileHelper::TempDir方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StrCat
TEST(FileTest, ExistsWildCard_Extension) {
FileHelper helper;
const string path = helper.CreateTempFile("msg00000.001", "msg00000.001");
ASSERT_TRUE(File::Exists(path));
string wildcard_path = StrCat(helper.TempDir(), File::pathSeparatorString, "msg*.001");
ASSERT_TRUE(File::ExistsWildcard(wildcard_path)) << path << "; w: " << wildcard_path;
wildcard_path = StrCat(helper.TempDir(), File::pathSeparatorString, "msg*.??1");
ASSERT_TRUE(File::ExistsWildcard(wildcard_path)) << path << "; w: " << wildcard_path;
}
示例2: getcwd
TEST(FileTest, SetCurrentDirectory) {
char expected[MAX_PATH];
getcwd(expected, MAX_PATH);
string original_dir = File::current_directory();
ASSERT_STREQ(expected, original_dir.c_str());
FileHelper helper;
File::set_current_directory(helper.TempDir());
EXPECT_EQ(helper.TempDir(), File::current_directory());
File::set_current_directory(original_dir);
}
示例3: dne
TEST(FileTest, DoesNotExist_Static) {
FileHelper file;
string tmp = file.TempDir();
GTEST_ASSERT_NE("", tmp);
File dne(tmp, "doesnotexist");
ASSERT_FALSE(File::Exists(dne.full_pathname()));
}
示例4: f
TEST(FileTest, Stream) {
FileHelper file;
File f(file.TempDir(), "newdir");
std::stringstream s;
s << f;
ASSERT_EQ(f.full_pathname(), s.str());
}
示例5: file
TEST(FileTest, GetParent) {
static const string kFileName = this->test_info_->name();
FileHelper helper;
string path = helper.CreateTempFile(kFileName, "Hello World");
File file(path);
ASSERT_EQ(helper.TempDir(), file.GetParent());
}
示例6: relative
TEST(FileTest, MakeAbsolutePath_AlreadyAbsolute) {
static const string kFileName = this->test_info_->name();
FileHelper helper;
const string path = helper.CreateTempFile(kFileName, "Hello World");
string relative(path); // Note: relative == absolute path (path)
File::MakeAbsolutePath(helper.TempDir(), &relative);
EXPECT_EQ(path, relative);
}
示例7:
TEST(FileTest, RealPath_Different) {
static const string kFileName = this->test_info_->name();
FileHelper helper;
const string path = helper.CreateTempFile(kFileName, "Hello World");
string realpath;
// Add an extra ./ into the path.
ASSERT_TRUE(File::RealPath(StrCat(helper.TempDir(), File::pathSeparatorString, ".", File::pathSeparatorString, kFileName), &realpath));
EXPECT_EQ(path, realpath);
}