本文整理汇总了C++中PathName::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ PathName::Get方法的具体用法?C++ PathName::Get怎么用?C++ PathName::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PathName
的用法示例。
在下文中一共展示了PathName::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: return
bool
File::Exists (/*[in]*/ const PathName & path)
{
struct stat statbuf;
if (stat(path.Get(), &statbuf) == 0)
{
if (S_ISDIR(statbuf.st_mode) != 0)
{
SessionImpl::theSession->trace_access->WriteFormattedLine
("core",
T_("%s is a directory"),
Q_(path));
return (false);
}
SessionImpl::theSession->trace_access->WriteFormattedLine
("core",
T_("accessing file %s: OK"),
Q_(path));
return (true);
}
int error = errno;
if (error != ENOENT)
{
FATAL_CRT_ERROR ("stat", path.Get());
}
SessionImpl::theSession->trace_access->WriteFormattedLine
("core",
T_("accessing file %s: NOK"),
Q_(path));
return (false);
}
示例2: trigger
bool
SessionImpl::CheckCandidate (/*[in,out]*/ PathName & path,
/*[in]*/ const char * lpszFileInfo)
{
bool found = false;
if (IsMpmFile(path.Get()))
{
PathName trigger (Utils::GetRelativizedPath(path.Get(), MPM_ROOT_PATH));
PathName installRoot;
if (lpszFileInfo != 0 && pInstallPackageCallback != 0
&& pInstallPackageCallback->InstallPackage(
lpszFileInfo, trigger.Get(), installRoot))
{
PathName temp = installRoot;
temp += path.Get() + MPM_ROOT_PATH_LEN;
if (File::Exists(temp))
{
path = temp;
found = true;
}
}
}
else
{
found = File::Exists(path);
}
return (found);
}
示例3:
void
Directory::SetCurrentDirectory (/*[in]*/ const PathName & path)
{
if (chdir(path.Get()) != 0)
{
FATAL_CRT_ERROR ("chdir", path.Get());
}
}
示例4: throw
int
main (/*[in]*/ int argc,
/*[in]*/ char ** argv)
{
try
{
SessionWrapper pSession;
Session::InitInfo initInfo;
initInfo.SetProgramInvocationName (argv[0]);
pSession.CreateSession (initInfo);
if (argc != 2)
{
tcerr << T_("Usage: mkocp OCPFILE") << endl;
throw (1);
}
PathName otp2ocp;
if (! pSession->FindFile(T_("otp2ocp"), FileType::EXE, otp2ocp))
{
tcerr << T_("mkocp: otp2ocp executable could not be found.") << endl;
throw (1);
}
char szFileName[BufferSizes::MaxPath];
char szExt[BufferSizes::MaxPath];
PathName::Split (argv[1],
0, 0,
szFileName, BufferSizes::MaxPath,
szExt, BufferSizes::MaxPath);
PathName outputName;
if (PathName::Compare(szExt, ".ocp") == 0)
{
outputName = szFileName;
}
else
{
outputName.Set (0, szFileName, szExt);
}
CommandLineBuilder commandLine;
commandLine.AppendArgument (outputName.Get());
Process::Run (otp2ocp.Get(), commandLine.Get());
tcout << outputName.Get() << ".ocp" << endl;
return (0);
}
catch (const MiKTeXException & e)
{
Utils::PrintException (e);
return (1);
}
catch (const exception & e)
{
Utils::PrintException (e);
return (1);
}
catch (int exitCode)
{
return (exitCode);
}
}
示例5: pathRelNotes
BOOL
FinishPage::OnWizardFinish ()
{
BOOL ret = CPropertyPage::OnWizardFinish();
if (ret)
{
try
{
CWnd * pWnd = GetDlgItem(IDC_VIEW_RELNOTES);
if (pWnd == 0)
{
UNEXPECTED_CONDITION ("FinishPage::OnWizardFinish");
}
if (viewReleaseNotes == BST_CHECKED)
{
if (pSheet->GetErrorFlag())
{
theApp.showLogFileOnExit = true;
}
else
{
PathName pathRelNotes (theApp.GetInstallRoot(),
MIKTEX_PATH_RELNOTES_HTML);
if (ShellExecuteW(0,
L"open",
UW_(pathRelNotes.Get()),
0,
0,
SW_SHOWNORMAL)
<= reinterpret_cast<HINSTANCE>(32))
{
FATAL_MIKTEX_ERROR ("FinishPage::OnWizardFinish",
T_("The file could not be opened."),
pathRelNotes.Get());
}
}
}
}
catch (const MiKTeXException & e)
{
pSheet->ReportError (e);
ret = FALSE;
}
catch (const exception & e)
{
pSheet->ReportError (e);
ret = FALSE;
}
}
return (ret);
}
示例6: pLister
void
Directory::Delete (/*[in]*/ const PathName & path,
/*[in]*/ bool recursive)
{
if (recursive)
{
PathNameArray vecFiles;
vecFiles.reserve (10);
PathNameArray vecDirectories;
vecDirectories.reserve (10);
auto_ptr<DirectoryLister> pLister (DirectoryLister::Open(path));
DirectoryEntry entry;
while (pLister->GetNext(entry))
{
if (entry.isDirectory)
{
vecDirectories.push_back (PathName(path.Get(),
entry.name.c_str(),
0));
}
else
{
vecFiles.push_back (PathName(path.Get(), entry.name.c_str(), 0));
}
}
pLister->Close ();
PathNameArray::const_iterator it;
// remove files
for (it = vecFiles.begin(); it != vecFiles.end(); ++ it)
{
File::Delete (*it, true);
}
// remove directories recursively
for (it = vecDirectories.begin(); it != vecDirectories.end(); ++ it)
{
// <recursivecall>
Delete (*it, true);
// </recursivecall>
}
}
// remove this directory
Directory::Delete (path);
}
示例7: attributes
void
File::SetNativeAttributes (/*[in]*/ const PathName & path,
/*[in]*/ unsigned long nativeAttributes)
{
SessionImpl::theSession->trace_files->WriteFormattedLine
("core",
T_("setting new attributes (%x) on %s"),
static_cast<int>(nativeAttributes),
Q_(path));
if (chmod(path.Get(), static_cast<mode_t>(nativeAttributes)) != 0)
{
FATAL_CRT_ERROR ("chmod", path.Get());
}
}
示例8: return
miktex_find_input_file (/*[in]*/ const char * lpszApplicationName,
/*[in]*/ const char * lpszFileName,
/*[out]*/ char * lpszPath)
{
C_FUNC_BEGIN ();
MIKTEX_ASSERT_STRING_OR_NIL (lpszApplicationName);
MIKTEX_ASSERT_STRING (lpszFileName);
MIKTEX_ASSERT_PATH_BUFFER (lpszPath);
PathName temp;
if (! SessionImpl::GetSession()->FindFile(lpszFileName,
FileType::None,
temp))
{
if (lpszApplicationName == 0)
{
return (0);
}
string searchPath = CURRENT_DIRECTORY;
searchPath += PATH_DELIMITER;
searchPath += TEXMF_PLACEHOLDER;
searchPath += MIKTEX_PATH_DIRECTORY_DELIMITER_STRING;
searchPath += lpszApplicationName;
searchPath += RECURSION_INDICATOR;
if (! SessionImpl::GetSession()->FindFile(lpszFileName,
searchPath.c_str(),
temp))
{
return (0);
}
}
Utils::CopyString (lpszPath, BufferSizes::MaxPath, temp.Get());
return (1);
C_FUNC_END ();
}
示例9: if
void
PostScript::DoSpecial (/*[in]*/ DvipsSpecial * pdvipsspecial)
{
Execute ("%d %d a\n",
pdvipsspecial->GetX() - pDviImpl->GetResolution(),
pdvipsspecial->GetY() - pDviImpl->GetResolution());
if (pdvipsspecial->GetProtection())
{
Execute ("@beginspecial\n");
Execute ("@setspecial\n");
}
if (pdvipsspecial->GetString())
{
Execute ("%s\n", pdvipsspecial->GetString());
}
else if (pdvipsspecial->GetFileName())
{
PathName filename;
if (! FindGraphicsFile(pdvipsspecial->GetFileName(), filename))
{
FATAL_MIKTEX_ERROR ("PostScript::DoSpecial",
T_("Cannot find file."), pdvipsspecial->GetFileName());
}
ExecuteEncapsulatedPostScript (filename.Get());
}
if (pdvipsspecial->GetProtection())
{
Execute("@endspecial\n");
}
}
示例10: return
bool
MakeXEmacsCommandLine (/*[out]*/ string & program,
/*[out]*/ string & arguments)
{
PathName emacsDir;
if (! ReadPath(
HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\xemacs.exe",
L"Path",
emacsDir))
{
return (false);
}
PathName pathEmacs;
pathEmacs = emacsDir;
pathEmacs += "runemacs.exe";
if (! File::Exists(pathEmacs))
{
pathEmacs = emacsDir;
pathEmacs += "xemacs.exe";
if (! File::Exists(pathEmacs))
{
return (false);
}
}
program = pathEmacs.Get();
arguments = "+%l \"%f\"";
return (true);
}
示例11: hFile
Dib::Dib (/*[in]*/ const PathName & path)
: hFile (INVALID_HANDLE_VALUE),
hMap (0),
pBitmapFileHeader (0)
{
AttachFile (path.Get());
}
示例12: destDir
void
File::Move (/*[in]*/ const PathName & source,
/*[in]*/ const PathName & dest)
{
struct stat sourceStat;
if (stat(source.Get(), &sourceStat) != 0)
{
FATAL_CRT_ERROR ("stat", source.Get());
}
PathName destDir (dest);
destDir.MakeAbsolute ();
destDir.RemoveFileSpec ();
struct stat destStat;
if (stat(destDir.Get(), &destStat) != 0)
{
FATAL_CRT_ERROR ("stat", destDir.Get());
}
bool sameDevice = (sourceStat.st_dev == destStat.st_dev);
if (sameDevice)
{
SessionImpl::theSession->trace_files->WriteFormattedLine
("core",
T_("renaming %s to %s"),
Q_(source),
Q_(dest));
if (rename(source.Get(), dest.Get()) != 0)
{
FATAL_CRT_ERROR ("rename", source.Get());
}
}
else
{
Copy (source, dest);
try
{
Delete (source);
}
catch (const MiKTeXException &)
{
try
{
if (Exists(source))
{
Delete (dest);
}
}
catch (const MiKTeXException &)
{
}
throw;
}
}
}
示例13: ExecuteBatch
void
PostScript::SendHeader (/*[in]*/ const char * lpszHeaderName)
{
PathName fileName;
if (! SessionWrapper(true)->FindFile(lpszHeaderName, FileType::PSHEADER, fileName))
{
FATAL_MIKTEX_ERROR (T_("PostScript::SendHeader"),
T_("Cannot find PostScript header file."), lpszHeaderName);
}
tracePS->WriteFormattedLine ("libdvi", T_("Sending %s..."), Q_(fileName));
ExecuteBatch (fileName.Get());
}
示例14:
void
Process::Run (/*[in]*/ const PathName & fileName,
/*[in]*/ const char * lpszArguments,
/*[int]*/ IRunProcessCallback * pCallback)
{
if (! Run(fileName, lpszArguments, pCallback, 0, 0))
{
FATAL_MIKTEX_ERROR ("Process::Run",
T_("The operation failed for some reason."),
fileName.Get());
}
}
示例15:
void
PostScript::Uncompress (/*[in]*/ const char * lpszFileName,
/*[out]*/ PathName & result)
{
PathName source;
if (! pDviImpl->FindGraphicsFile(lpszFileName, source))
{
FATAL_MIKTEX_ERROR ("PostScript::Uncompress",
T_("Cannot find file."), lpszFileName);
}
Utils::UncompressFile (source.Get(), result);
pDviImpl->RememberTempFile(lpszFileName, result);
}