本文整理汇总了C++中FilePath::complete方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::complete方法的具体用法?C++ FilePath::complete怎么用?C++ FilePath::complete使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::complete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveWorkingContext
void saveWorkingContext(const FilePath& statePath,
Settings* pSettings,
bool* pSaved)
{
// save history
FilePath historyPath = statePath.complete(kHistoryFile);
Error error = consoleHistory().saveToFile(historyPath);
if (error)
{
reportError(kSaving, kHistoryFile, error, ERROR_LOCATION);
*pSaved = false;
}
// save client metrics
client_metrics::save(pSettings);
// save aliased path to current working directory
std::string workingDirectory = FilePath::createAliasedPath(
utils::safeCurrentPath(),
r::session::utils::userHomePath());
pSettings->set(kWorkingDirectory, workingDirectory);
// save console actions
FilePath consoleActionsPath = statePath.complete(kConsoleActionsFile);
error = consoleActions().saveToFile(consoleActionsPath);
if (error)
{
reportError(kSaving, kConsoleActionsFile, error, ERROR_LOCATION);
*pSaved = false;
}
}
示例2: rBinaryPath
FilePath rBinaryPath()
{
FilePath binPath = FilePath(R_HomeDir()).complete("bin");
#ifdef _WIN32
return binPath.complete("Rterm.exe");
#else
return binPath.complete("R");
#endif
}
示例3: urlopenerPath
FilePath Options::urlopenerPath() const
{
FilePath parentDir = scriptsPath();
// detect dev configuration
if (parentDir.filename() == "desktop")
parentDir = parentDir.complete("urlopener");
return parentDir.complete("urlopener.exe");
}
示例4: rsinversePath
FilePath Options::rsinversePath() const
{
FilePath parentDir = scriptsPath();
// detect dev configuration
if (parentDir.filename() == "desktop")
parentDir = parentDir.complete("synctex/rsinverse");
return parentDir.complete("rsinverse.exe");
}
示例5: wwwDocsPath
FilePath Options::wwwDocsPath() const
{
FilePath supportingFilePath = desktop::options().supportingFilePath();
FilePath wwwDocsPath = supportingFilePath.complete("www/docs");
if (!wwwDocsPath.exists())
wwwDocsPath = supportingFilePath.complete("../gwt/www/docs");
#ifdef __APPLE__
if (!wwwDocsPath.exists())
wwwDocsPath = supportingFilePath.complete("../../../../../gwt/www/docs");
#endif
return wwwDocsPath;
}
示例6: texFilePath
FilePath texFilePath(const std::string& logPath, const FilePath& compileDir)
{
// some tex compilers report file names with absolute paths and some
// report them relative to the compilation directory -- on Posix use
// realPath to get a clean full path back -- note the fact that we
// don't do this on Windows is a tacit assumption that Windows TeX logs
// are either absolute or don't require interpretation of .., etc.
FilePath path = compileDir.complete(logPath);
#ifdef _WIN32
return path;
#else
FilePath realPath;
Error error = core::system::realPath(path.absolutePath(), &realPath);
if (error)
{
LOG_ERROR(error);
return path;
}
else
{
return realPath;
}
#endif
}
示例7: detectZipFileOverwrites
Error detectZipFileOverwrites(const FilePath& uploadedZipFile,
const FilePath& destDir,
json::Array* pOverwritesJson)
{
// query for all of the paths in the zip file
std::vector<std::string> zipFileListing;
r::exec::RFunction listZipFile(".rs.listZipFile",
uploadedZipFile.absolutePath());
Error unzipError = listZipFile.call(&zipFileListing);
if (unzipError)
return unzipError;
// check for overwrites
for (std::vector<std::string>::const_iterator
it = zipFileListing.begin();
it != zipFileListing.end();
++it)
{
FilePath filePath = destDir.complete(*it);
if (filePath.exists())
pOverwritesJson->push_back(module_context::createFileSystemItem(filePath));
}
return Success();
}
示例8: handleHelpHomeRequest
void handleHelpHomeRequest(const core::http::Request& request,
const std::string& jsCallbacks,
core::http::Response* pResponse)
{
// get the resource path
FilePath helpResPath = options().rResourcesPath().complete("help_resources");
// resolve the file reference
std::string path = http::util::pathAfterPrefix(request,
"/help/doc/home/");
// if it's empty then this is the root template
if (path.empty())
{
std::map<std::string,std::string> variables;
variables["js_callbacks"] = jsCallbacks;
text::TemplateFilter templateFilter(variables);
pResponse->setNoCacheHeaders();
pResponse->setFile(helpResPath.childPath("index.htm"),
request,
templateFilter);
}
// otherwise it's just a file reference
else
{
FilePath filePath = helpResPath.complete(path);
pResponse->setCacheableFile(filePath, request);
}
}
示例9: QDialog
AboutDialog::AboutDialog(QWidget *parent) :
QDialog(parent, Qt::Dialog),
ui(new Ui::AboutDialog())
{
ui->setupUi(this);
ui->buttonBox->addButton(new QPushButton(QString::fromUtf8("OK")),
QDialogButtonBox::AcceptRole);
ui->lblIcon->setPixmap(QPixmap(QString::fromUtf8(":/icons/resources/freedesktop/icons/64x64/rstudio.png")));
ui->lblVersion->setText(QString::fromUtf8(
"Version " RSTUDIO_VERSION " - © 2009-2012 RStudio, Inc."));
setWindowModality(Qt::ApplicationModal);
// read notice file
FilePath supportingFilePath = options().supportingFilePath();
FilePath noticePath = supportingFilePath.complete("NOTICE");
std::string notice;
Error error = readStringFromFile(noticePath, ¬ice);
if (!error)
{
ui->textBrowser->setFontFamily(options().fixedWidthFont());
#ifdef Q_OS_MAC
ui->textBrowser->setFontPointSize(11);
#else
ui->textBrowser->setFontPointSize(9);
#endif
ui->textBrowser->setText(QString::fromUtf8(notice.c_str()));
}
}
示例10: copySourceFile
bool copySourceFile(const FilePath& sourceDir,
const FilePath& destDir,
int level,
const FilePath& sourceFilePath)
{
// compute the target path
std::string relativePath = sourceFilePath.relativePath(sourceDir);
FilePath targetPath = destDir.complete(relativePath);
// if the copy item is a directory just create it
if (sourceFilePath.isDirectory())
{
Error error = targetPath.ensureDirectory();
if (error)
LOG_ERROR(error);
}
// otherwise copy it
else
{
Error error = sourceFilePath.copy(targetPath);
if (error)
LOG_ERROR(error);
}
return true;
}
示例11: initialize
void RestartContext::initialize(const FilePath& scopePath,
const std::string& contextId)
{
FilePath contextsPath = restartContextsPath(scopePath);
FilePath statePath = contextsPath.complete(kContext + contextId);
if (statePath.exists())
sessionStatePath_ = statePath;
}
示例12: createSessionStatePath
FilePath RestartContext::createSessionStatePath(const FilePath& scopePath,
const std::string& contextId)
{
FilePath contextsPath = restartContextsPath(scopePath);
FilePath statePath = contextsPath.complete(kContext + contextId);
Error error = statePath.ensureDirectory();
if (error)
LOG_ERROR(error);
return statePath;
}
示例13: prepareEnvironment
bool prepareEnvironment(Options& options)
{
// check for which R override
FilePath rWhichRPath;
std::string whichROverride = ::core::system::getenv("RSTUDIO_WHICH_R");
if (!whichROverride.empty())
rWhichRPath = FilePath(whichROverride);
// determine rLdPaths script location
FilePath supportingFilePath = options.supportingFilePath();
FilePath rLdScriptPath = supportingFilePath.complete("bin/r-ldpath");
if (!rLdScriptPath.exists())
rLdScriptPath = supportingFilePath.complete("session/r-ldpath");
// attempt to detect R environment
std::string rScriptPath, rVersion, errMsg;
r_util::EnvironmentVars rEnvVars;
bool success = r_util::detectREnvironment(rWhichRPath,
rLdScriptPath,
std::string(),
&rScriptPath,
&rVersion,
&rEnvVars,
&errMsg);
if (!success)
{
showRNotFoundError(errMsg);
return false;
}
if (desktop::options().runDiagnostics())
{
std::cout << std::endl << "Using R script: " << rScriptPath
<< std::endl;
}
// set environment and return true
r_util::setREnvironmentVars(rEnvVars);
return true;
}
示例14: initialize
Error PersistentState::initialize()
{
serverMode_ = (session::options().programMode() ==
kSessionProgramModeServer);
// always the same so that we can supporrt a restart of
// the session without reloading the client page
desktopClientId_ = "33e600bb-c1b1-46bf-b562-ab5cba070b0e";
FilePath scratchPath = module_context::scopedScratchPath();
FilePath statePath = scratchPath.complete("persistent-state");
return settings_.initialize(statePath);
}
示例15: currentViewerSourcePath
Error currentViewerSourcePath(FilePath* pSourcePath)
{
// determine source path
module_context::ViewerHistoryEntry viewerEntry = viewerHistory().current();
if (viewerEntry.empty())
{
return systemError(boost::system::errc::invalid_argument,
ERROR_LOCATION);
}
FilePath tempPath = module_context::tempDir();
*pSourcePath = tempPath.complete(viewerEntry.sessionTempPath());
return Success();
}