本文整理汇总了C++中PathName::ToString方法的典型用法代码示例。如果您正苦于以下问题:C++ PathName::ToString方法的具体用法?C++ PathName::ToString怎么用?C++ PathName::ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathName
的用法示例。
在下文中一共展示了PathName::ToString方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pathtok
MPMSTATICFUNC(void) RememberFileNameInfo(const string& prefixedFileName, const string& packageId)
{
shared_ptr<Session> session = Session::Get();
string fileName;
// ignore non-texmf files
if (!PackageManager::StripTeXMFPrefix(prefixedFileName, fileName))
{
return;
}
PathNameParser pathtok(fileName);
if (!pathtok)
{
return;
}
// initialize root path: "//MiKTeX/[MPM]"
PathName path = session->GetMpmRootPath();
// path += CURRENT_DIRECTORY;
// s1: current path name component
string s1 = *pathtok;
++pathtok;
// name: file name component
string name = s1;
while (pathtok)
{
string s2 = *pathtok;
++pathtok;
directoryInfoTable[path.ToString()].subDirectoryNames.insert(s1);
name = s2;
#if defined(MIKTEX_WINDOWS)
// make sure the the rest of the path contains slashes (not
// backslashes)
path.AppendAltDirectoryDelimiter();
#else
path.AppendDirectoryDelimiter();
#endif
path /= s1;
s1 = s2;
}
DirectoryInfo& directoryInfo = directoryInfoTable[path.ToString()];
directoryInfo.fileNames.push_back(name);
directoryInfo.packageNames.push_back(packageId);
}
示例2: SetAuxDirectory
void WebAppInputLine::SetAuxDirectory(const PathName& path)
{
if (pimpl->auxDirectory == path)
{
return;
}
LogInfo("setting aux directory: " + path.ToString());
pimpl->auxDirectory = path;
}
示例3: ReadDirectory
bool PackageManagerImpl::ReadDirectory(const PathName& path, vector<string>& subDirNames, vector<string>& fileNames, vector<string>& fileNameInfos)
{
const DirectoryInfo& directoryInfo = directoryInfoTable[path.ToString()];
for (const string& name : directoryInfo.subDirectoryNames)
{
subDirNames.push_back(name);
}
fileNames = directoryInfo.fileNames;
fileNameInfos = directoryInfo.packageNames;
return true;
}
示例4: ConvertToBitmapFile
bool SessionImpl::ConvertToBitmapFile(const PathName& sourceFileName, PathName& destFileName, IRunProcessCallback* callback)
{
string ext = sourceFileName.GetExtension();
if (ext.empty())
{
MIKTEX_FATAL_ERROR_2(T_("No file name extension in graphics rule."), "path", ext);
}
string rule;
if (!FindGraphicsRule(ext, ".bmp", rule))
{
MIKTEX_FATAL_ERROR_2(T_("No conversion rule found."), "path", sourceFileName.ToString());
}
destFileName.SetToTempFile();
#if defined(MIKTEX_WINDOWS)
Utils::RemoveBlanksFromPathName(destFileName);
#endif
string commandLine;
for (const char* lpsz = rule.c_str(); *lpsz != 0; ++lpsz)
{
if (*lpsz == '%')
{
++lpsz;
switch (*lpsz)
{
case 'i':
commandLine += sourceFileName.GetData();
break;
case 'o':
commandLine += destFileName.GetData();
break;
}
}
else
{
commandLine += *lpsz;
}
}
bool done = Process::ExecuteSystemCommand(commandLine, nullptr, callback, nullptr);
if (!done)
{
File::Delete(destFileName, { FileDeleteOption::TryHard });
}
return done;
}
示例5: Open
void PipeStream::Open(const PathName& fileName, const vector<string>& arguments)
{
childStartInfo.FileName = fileName.ToString();
childStartInfo.Arguments = arguments;
childStartInfo.RedirectStandardInput = true;
childStartInfo.RedirectStandardError = true;
childStartInfo.RedirectStandardOutput = true;
childProcess = Process::Start(childStartInfo);
Application::GetApplication()->LogInfo("started PipeStream child process " + std::to_string(childProcess->GetSystemId()) + ": " + StringUtil::Flatten(arguments, ' '));
childStdinFile = childProcess->get_StandardInput();
setvbuf(childStdinFile, nullptr, _IONBF, 0);
StartThreads();
}
示例6: 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;
}
示例7: 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;
}
}
示例8: AppendRedirection
void CommandLineBuilder::AppendRedirection(const PathName& path_, string direction)
{
#if defined(MIKTEX_WINDOWS)
string path = PathName(path_).ToDos().ToString();
#else
string path = path_.ToString();
#endif
pimpl->str += direction;
bool needsQuoting = path.find_first_of(pimpl->needsQuoting) != string::npos;
if (needsQuoting)
{
pimpl->str += '"';
}
pimpl->str += path;
if (needsQuoting)
{
pimpl->str += '"';
}
}
示例9: path
void
TpmParser::GetFiles (/*[in]*/ const XML_Char * lpszFiles,
/*[out]*/ vector<string> & files)
{
MIKTEX_ASSERT (Utils::IsAscii(lpszFiles));
for (Tokenizer tok (lpszFiles, X_(";\n\r \t"));
tok.GetCurrent() != 0;
++ tok)
{
PathName path (tok.GetCurrent());
#if defined(MIKTEX_UNIX)
path.ToUnix ();
#endif
if (texMFPrefix.length() == 0
|| (PathName::Compare(texMFPrefix, path, texMFPrefix.length()) == 0))
{
files.push_back (path.ToString());
}
}
}
示例10: inputStream
void
Tfm::Read ()
{
if (! dviChars.empty() || dviInfo.notLoadable)
{
return;
}
trace_tfm->WriteFormattedLine
("libdvi",
T_("going to load TFM file %s"),
dviInfo.name.c_str());
PathName fileName;
bool tfmFileExists =
SessionWrapper(true)->FindTfmFile(dviInfo.name.c_str(),
fileName,
false);
if (! tfmFileExists)
{
if (Make(dviInfo.name))
{
tfmFileExists =
SessionWrapper(true)->FindTfmFile(dviInfo.name.c_str(),
fileName,
false);
if (! tfmFileExists)
{
// this shouldn't happen; but it does (#521481)
}
}
if (! tfmFileExists)
{
dviInfo.transcript += "\r\n";
dviInfo.transcript += T_("Loading 'cmr10' instead.\r\n");
trace_error->WriteFormattedLine
("libdvi",
T_("'%s' not loadable - loading 'cmr10' instead!"),
dviInfo.name.c_str());
if (! (SessionWrapper(true)->FindTfmFile("cmr10",
fileName,
false)
|| (Make("cmr10")
&& SessionWrapper(true)->FindTfmFile("cmr10",
fileName,
false))))
{
dviInfo.transcript += T_("'cmr10' not loadable either!");
trace_error->WriteLine
("libdvi",
T_("'cmr10' not loadable - will display blank chars!"));
return;
}
}
}
dviInfo.fileName = fileName.ToString();
trace_tfm->WriteFormattedLine
("libdvi",
T_("opening TFM file %s"),
fileName.Get());
InputStream inputStream (fileName.Get());
long lf = inputStream.ReadSignedPair();
if (lf == 0)
{
FATAL_DVI_ERROR ("Tfm::Read",
T_("Invalid TFM file."),
0);
}
long lh = inputStream.ReadSignedPair();
long bc = inputStream.ReadSignedPair();
long ec = inputStream.ReadSignedPair();
long nw = inputStream.ReadSignedPair();
long nh = inputStream.ReadSignedPair();
long nd = inputStream.ReadSignedPair();
long ni = inputStream.ReadSignedPair();
long nl = inputStream.ReadSignedPair();
long nk = inputStream.ReadSignedPair();
long ne = inputStream.ReadSignedPair();
long np = inputStream.ReadSignedPair();
trace_tfm->WriteFormattedLine
("libdvi",
T_("header size: %ld"),
lh);
trace_tfm->WriteFormattedLine
("libdvi",
T_("smallest character code: %ld"),
bc);
trace_tfm->WriteFormattedLine
("libdvi",
//.........这里部分代码省略.........
示例11: SetMiKTeXDirectRoot
void PackageManager::SetMiKTeXDirectRoot(const PathName& path)
{
shared_ptr<Session> session = Session::Get();
session->SetConfigValue(MIKTEX_REGKEY_PACKAGE_MANAGER, MIKTEX_REGVAL_MIKTEXDIRECT_ROOT, path.ToString());
}
示例12: SetLocalPackageRepository
void PackageManager::SetLocalPackageRepository(const PathName& path)
{
Session::Get()->SetConfigValue(MIKTEX_REGKEY_PACKAGE_MANAGER, MIKTEX_REGVAL_LOCAL_REPOSITORY, path.ToString());
}