当前位置: 首页>>代码示例>>C++>>正文


C++ PathName::ToWideCharString方法代码示例

本文整理汇总了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;
}
开发者ID:MiKTeX,项目名称:miktex,代码行数:14,代码来源:winUtils.cpp

示例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;
  }
}
开发者ID:MiKTeX,项目名称:miktex,代码行数:18,代码来源:winUtils.cpp

示例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
}
开发者ID:bngabonziza,项目名称:miktex,代码行数:81,代码来源:files.cpp


注:本文中的PathName::ToWideCharString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。