本文整理汇总了C++中CAutoTempDir::GetTempDir方法的典型用法代码示例。如果您正苦于以下问题:C++ CAutoTempDir::GetTempDir方法的具体用法?C++ CAutoTempDir::GetTempDir怎么用?C++ CAutoTempDir::GetTempDir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CAutoTempDir
的用法示例。
在下文中一共展示了CAutoTempDir::GetTempDir方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
TEST(CGitAdminDir, IsBareRepo_ReferencedRepo)
{
CAutoTempDir tmpDir;
CString gitFile = tmpDir.GetTempDir() + L"\\.git";
EXPECT_TRUE(CStringUtils::WriteStringToTextFile((LPCTSTR)gitFile, L"gitdir: dontcare"));
EXPECT_FALSE(GitAdminDir::IsBareRepo(tmpDir.GetTempDir()));
}
示例2: GetStatus
TEST(GitWCRevStatus, EmptyBareRepo)
{
CAutoTempDir tempdir;
git_repository_init_options options = GIT_REPOSITORY_INIT_OPTIONS_INIT;
options.flags = GIT_REPOSITORY_INIT_MKPATH | GIT_REPOSITORY_INIT_BARE | GIT_REPOSITORY_INIT_NO_DOTGIT_DIR;
CAutoRepository repo;
ASSERT_EQ(0, git_repository_init_ext(repo.GetPointer(), CUnicodeUtils::GetUTF8(tempdir.GetTempDir()), &options));
GitWCRev_t GitStat;
EXPECT_EQ(ERR_NOWC, GetStatus(tempdir.GetTempDir(), GitStat));
}
示例3: sizeof
TEST(UpdateCrypto, Binary)
{
CAutoTempDir tempdir;
CString testFile = tempdir.GetTempDir() + L"\\test.bin";
unsigned char binaryFile[99] = // based on link.png
{
0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52,
0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x01, 0x03, 0x00, 0x00, 0x00, 0xFE, 0xC1, 0x2C,
0xC8, 0x00, 0x00, 0x00, 0x06, 0x50, 0x4C, 0x54, 0x45, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xA5,
0xD9, 0x9F, 0xDD, 0x00, 0x00, 0x00, 0x18, 0x49, 0x44, 0x41, 0x54, 0x78, 0x5E, 0x63, 0xF8, 0xC0,
0xF0, 0x87, 0xE1, 0x17, 0x83, 0x18, 0x43, 0x3E, 0x43, 0x38, 0x43, 0x39, 0x03, 0x3B, 0x00, 0x2C,
0x98, 0x04, 0x41, 0xFA, 0xEC, 0xE7, 0x75, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4E, 0x44, 0xAE,
0x42, 0x60, 0x82,
};
CAutoFile file = ::CreateFile(testFile, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
ASSERT_TRUE(file.IsValid());
DWORD written = 0;
EXPECT_TRUE(::WriteFile(file, binaryFile, sizeof(binaryFile), &written, nullptr));
EXPECT_EQ(sizeof(binaryFile), written);
EXPECT_TRUE(file.CloseHandle());
CString testFileSignature = testFile + _T(".rsa.asc");
EXPECT_TRUE(CStringUtils::WriteStringToTextFile((LPCTSTR)testFileSignature, L"-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v2\n\niQIcBAABCgAGBQJVxPvgAAoJEPfxez+d2VOerKsP/iQlt4S20LdUknT5udD8fFpT\nEFhZDPTXMRWkd8OhCLxa+t5b/ijyxFKWNz808Q7BDQcQoOQtC19NDvVmAcfqXflt\nR4Z+ugCG/lqP+3y0xBrL9m4UT9fNzQCiUY8Xpaih+6riLGnXVVpUe29BgVZppEWn\nMG9RVXpXwC+M3VQ0yQWu1F2Yy5OjdH4Ww5kpluoseZMOPhT6VaSfXeyQmg2DrBbw\nUfVV+w718noZ5znDH9MiD5y+sd4o7vqN2YFdg6FNvTjHyha39aFV8UCpPX1lH9ME\nN9v1vt5IWGCWL0zsZ6umHqibGG3Q2S3mlqktFhKJGWci+Swy4cNMpXDHIKY6e5v7\nxPIP92djyFtbjdixcSqBaYFC/Dd0KuCa1eYmyi2KxzUP29rZ+EHWoazfbeL1Y2Pu\nkSBrVFv64j0URzSMxUpJMqYXZRC5QW7vdbVwHGAPzoS+0rBBddwfSKteBQjagcHA\nkLk3sAIZNj1JaP5dcGL2K4Wxlaae0WgwI48lZSBMoL8SaInQvcKq9iL64xfpU+FU\nG0mzbidvTfZpyEU3eeSNiFi+6z4XLQ3NUFxsOr5jEPVKvgRoPljhJ4nCx034KQRQ\nHbVF9KYgMJSroKN9bNi/UFkC45Pc4wVov/XyH82XCVS30Du4hsVXsTdAiiXb3i6w\nkrWIJWYRxx76XGtQoHrR\n=PlFQ\n-----END PGP SIGNATURE-----"));
EXPECT_EQ(0, VerifyIntegrity(testFile, testFileSignature, nullptr));
// signature is shorter than pubkey; did not work w/o commit 941c103c00e48b0ffe592ab4d87d40ff48f899f6
EXPECT_TRUE(CStringUtils::WriteStringToTextFile((LPCTSTR)testFileSignature, L"-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v2\n\niQIbBAABCgAGBQJVxQQOAAoJEPfxez+d2VOe7GoP+KflvYJVpNXSwnteXyDc1zTo\nJAyAJFtW6mgqCLrN6KoMrncEvd0cHrD07hT5mxULkbP6zy9fGaFYF0gHO0mOqErF\nIIbDcpPTWooJWUHMbnuQjf2I0x70Cr8ikycZQ7uDg7scZx7E8EIwHOJX60dcfdVX\nK1SQ+c+VIvo1uxL1PndloACaeINz6rL0Pj504lVDJaaGBvzdAV6KEIcjjm+Jb4r0\n6CYEntmt1i3Mc8FM6Xp1QfGtJqp4ogjv6o89hvtaBBLihB54EVQn66/2qIjdhX8W\nkdqJE6+pmFTfuD02XNECwl6stDIZcxXCw6EE87/1hdHip8oW9enIVTxKWB3fUWHl\n236eE2qb8zAN/WWGx/2Cvi6ctyosy9Cc/1hopnmV0KgZFfmDJWw0lISlC/3ZYWEe\nQFiXs5FPzLwfKnkq4REpoOKKfbZNk329J2iLFnwrF0mlL4vUZ1m26BBBk6lhm41J\nnjOSFWhJG/AqBbR5DqdJfXMqnxpfVZfaE5cry2rhjI4mfzw0xzrgvL4M9FZ7R9F8\njVHAV11CMqtp/7gMHXu6ljkTEBBQ7cgbU5DEAwfWddaJF+R30jmNSVliN2JW2FAk\nIbE8yV+uPiyXebn49CmRzkOWOAZqx+DShqriXGam37qjhdys147wPMMiwk8lZKjP\n4V66gTFw45UvBpophyg=\n=0bmW\n-----END PGP SIGNATURE-----"));
EXPECT_EQ(0, VerifyIntegrity(testFile, testFileSignature, nullptr));
}
示例4:
TEST(CPathUtils, MakeSureDirectoryPathExists)
{
CAutoTempDir tmpDir;
EXPECT_TRUE(PathIsDirectory(tmpDir.GetTempDir()));
EXPECT_FALSE(PathFileExists(tmpDir.GetTempDir() + L"\\sub"));
EXPECT_FALSE(PathIsDirectory(tmpDir.GetTempDir() + L"\\sub"));
EXPECT_TRUE(CPathUtils::MakeSureDirectoryPathExists(tmpDir.GetTempDir() + L"\\sub\\sub\\dir"));
EXPECT_TRUE(PathIsDirectory(tmpDir.GetTempDir() + L"\\sub"));
EXPECT_TRUE(PathIsDirectory(tmpDir.GetTempDir() + L"\\sub\\sub"));
EXPECT_TRUE(PathIsDirectory(tmpDir.GetTempDir() + L"\\sub\\sub\\dir"));
EXPECT_TRUE(CPathUtils::MakeSureDirectoryPathExists(tmpDir.GetTempDir() + L"\\sub/asub/adir"));
EXPECT_TRUE(PathIsDirectory(tmpDir.GetTempDir() + L"\\sub"));
EXPECT_TRUE(PathIsDirectory(tmpDir.GetTempDir() + L"\\sub\\asub"));
EXPECT_TRUE(PathIsDirectory(tmpDir.GetTempDir() + L"\\sub\\asub\\adir"));
}
示例5: VerifyIntegrity
TEST(UpdateCrypto, NewLine)
{
CAutoTempDir tempdir;
CString testFile = tempdir.GetTempDir() + L"\\.test.txt";
EXPECT_TRUE(CStringUtils::WriteStringToTextFile((LPCTSTR)testFile, L"Text with\nNewline"));
CString testFileSignature = testFile + _T(".rsa.asc");
CString signature = L"-----BEGIN PGP SIGNATURE-----\nVersion: GnuPG v2\n\niQIcBAEBCgAGBQJVxPp9AAoJEPfxez+d2VOeGsIQAJYSxXcBeYs7gwz3+NwWSv/D\nUL+d1rJgIwyIXQ46BjiCno0a6NJ7JxPYkhl9Tqj2WenQRzQqqYZNRUPN8xEU0lSC\nS8q2B+uEGopqHG5a+/X/FJh1ijeeK75ey3HKHyn7BpH66IsDU2HZ517w6/FJOsHE\n295s+RwgojR7ghk+dqu+LrkJxldQ3r9jRDujuez5NSj1aPU5IRazyf864vl13W9O\n+7NfyjNyPmZxK/nzYPi9nujsWGXjVKYqomzfEUu7FShv4Ic0vdzHcSQdS4wVsxHc\n9Feo1dfTTaCrXnYo5vSQB+b4C6EQ0DZXW0vGOjwBFHpHCLuAgyOaUccnsyKZDNnx\nmx8QK1hb13gP5oBsShS5VxgBGhl3BP47jTiaSIf9QSGOGZih+kfAzcu0e2VGJ5Xo\nYkTAhAH/x9kRjCRze0qtH7Y3CIY3O/fFTnQmNVGr25Wrhfs7aL0rF80mTk/lwbR+\nGIlrRC2lyQGEl8hfgHfvnau+biW0GRKIINLB/i86VFzUwPS5Y4XoAbKftQoEdyQj\nJ1OaVDQxlIvx/6O0bY2nw/9fflnoeBFWzcgyaYOAV95XwVjid4DkQyInkoLGCC1p\novO/2+3zPnOoab/L8ZlR8lzgDBjn5zzZRxX0CHlgLPPzLpTCFZgxOh8KIzJ04uKU\nY72YA8friiI836RZVoXq\n=i5FK\n-----END PGP SIGNATURE-----";
EXPECT_TRUE(CStringUtils::WriteStringToTextFile((LPCTSTR)testFileSignature, (LPCTSTR)signature));
EXPECT_EQ(0, VerifyIntegrity(testFile, testFileSignature, nullptr));
EXPECT_TRUE(CStringUtils::WriteStringToTextFile((LPCTSTR)testFile, L"Text with\r\nNewline"));
EXPECT_EQ(0, VerifyIntegrity(testFile, testFileSignature, nullptr));
EXPECT_EQ(16, signature.Replace(L"\n", L"\r\n"));
EXPECT_TRUE(CStringUtils::WriteStringToTextFile((LPCTSTR)testFileSignature, (LPCTSTR)signature));
EXPECT_EQ(0, VerifyIntegrity(testFile, testFileSignature, nullptr));
}