本文整理汇总了C++中PathName::ToWideCharString方法的典型用法代码示例。如果您正苦于以下问题:C++ PathName::ToWideCharString方法的具体用法?C++ PathName::ToWideCharString怎么用?C++ PathName::ToWideCharString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathName
的用法示例。
在下文中一共展示了PathName::ToWideCharString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CanonicalizePathName
void Utils::CanonicalizePathName(PathName& path)
{
wchar_t szFullPath[BufferSizes::MaxPath];
DWORD n = GetFullPathNameW(path.ToWideCharString().c_str(), BufferSizes::MaxPath, szFullPath, nullptr);
if (n == 0)
{
MIKTEX_FATAL_WINDOWS_ERROR_2("GetFullPathNameW", "path", path.ToString());
}
if (n >= BufferSizes::MaxPath)
{
BUF_TOO_SMALL();
}
path = szFullPath;
}
示例2: SupportsHardLinks
bool Utils::SupportsHardLinks(const PathName& path)
{
DWORD fileSystemFlags;
wchar_t fileSystemName[_MAX_PATH];
PathName root = path.GetMountPoint();
if (GetVolumeInformationW(root.ToWideCharString().c_str(), nullptr, 0, nullptr, nullptr, &fileSystemFlags, fileSystemName, _MAX_PATH) == 0)
{
MIKTEX_FATAL_WINDOWS_ERROR_2("GetVolumeInformationW", "root", root.ToString());
}
if (WindowsVersion::IsWindows7OrGreater())
{
return (fileSystemFlags & FILE_SUPPORTS_HARD_LINKS) != 0;
}
else
{
return _wcsicmp(fileSystemName, L"NTFS") == 0;
}
}
示例3: absPath
void
File::Delete (/*[in]*/ const PathName & path,
/*[in]*/ bool tryHarder,
/*[in]*/ bool updateFndb)
{
if (updateFndb
&& SessionImpl::GetSession()->IsTEXMFFile(path.Get(), 0, 0)
&& Fndb::FileExists(path))
{
Fndb::Remove (path);
}
FileAttributes attributes = File::GetAttributes(path);
bool done;
try
{
if ((attributes & FileAttributes::ReadOnly) != 0)
{
attributes &= ~ FileAttributes(FileAttributes::ReadOnly);
File::SetAttributes (path, attributes);
}
File::Delete (path);
done = true;
}
catch (const UnauthorizedAccessException &)
{
#if defined(MIKTEX_WINDOWS)
if (! tryHarder)
{
throw;
}
done = false;
#else
throw;
#endif
}
#if defined(MIKTEX_WINDOWS)
if (! done)
{
// move the file out of the way
PathName absPath (path);
if (! Utils::IsAbsolutePath(path.Get()))
{
absPath.MakeAbsolute ();
}
wchar_t szDir[BufferSizes::MaxPath];
if (IsWindowsNT())
{
DllProc3<BOOL, LPCWSTR, LPWSTR, DWORD>
getVolumePathNameW ("Kernel32.dll", "GetVolumePathNameW");
if (! getVolumePathNameW(absPath.ToWideCharString().c_str(),
szDir,
BufferSizes::MaxPath))
{
FATAL_WINDOWS_ERROR ("GetVolumePathNameA", absPath.Get());
}
}
else
{
#if defined(MIKTEX_SUPPORT_LEGACY_WINDOWS)
dir = absPath;
dir.RemoveFileSpec ();
#else
UNSUPPORTED_PLATFORM ();
#endif
}
wchar_t szTemp[BufferSizes::MaxPath];
if (GetTempFileNameW(szDir, L"mik", 0, szTemp) == 0)
{
FATAL_WINDOWS_ERROR ("GetTempFileNameW", WU_(szDir));
}
File::Delete (szTemp);
File::Move (absPath, szTemp);
SessionImpl::GetSession()->ScheduleFileRemoval (PathName(szTemp).Get());
}
#endif
}