本文整理汇总了C++中FilePath::move方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::move方法的具体用法?C++ FilePath::move怎么用?C++ FilePath::move使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::move方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: renameFile
// IN: String path, String targetPath
core::Error renameFile(const core::json::JsonRpcRequest& request,
json::JsonRpcResponse* pResponse)
{
// read params
std::string path, targetPath;
Error error = json::readParams(request.params, &path, &targetPath);
if (error)
return error ;
// if the destination already exists then send back file exists
FilePath destPath = module_context::resolveAliasedPath(targetPath) ;
if (destPath.exists())
return fileExistsError(ERROR_LOCATION);
// create file info now before we remove
FilePath sourcePath = module_context::resolveAliasedPath(path);
FileInfo sourceFileInfo(sourcePath);
// move the file
Error renameError = sourcePath.move(destPath);
if (renameError)
return renameError ;
// generate delete event for folders (inotify doesn't do this right now)
if (sourceFileInfo.isDirectory())
enqueFileRemovedEvent(sourceFileInfo);
return Success() ;
}
示例2: renameFile
// IN: String path, String targetPath
core::Error renameFile(const core::json::JsonRpcRequest& request,
json::JsonRpcResponse* pResponse)
{
// read params
std::string path, targetPath;
Error error = json::readParams(request.params, &path, &targetPath);
if (error)
return error ;
// if the destination already exists then send back file exists
FilePath destPath = module_context::resolveAliasedPath(targetPath) ;
if (destPath.exists())
return fileExistsError(ERROR_LOCATION);
// move the file
FilePath sourcePath = module_context::resolveAliasedPath(path);
Error renameError = sourcePath.move(destPath);
if (renameError)
return renameError ;
// propagate rename to source database (non fatal if this fails)
error = source_database::rename(sourcePath, destPath);
if (error)
LOG_ERROR(error);
return Success() ;
}
示例3: createSessionDirFromOldSourceDatabase
Error createSessionDirFromOldSourceDatabase(FilePath* pSessionDir)
{
// move properties (if any) into new source database root
FilePath propsPath = oldSourceDatabaseRoot().complete("properties");
if (propsPath.exists())
{
FilePath newPropsPath = sourceDatabaseRoot().complete("prop");
Error error = propsPath.move(newPropsPath);
if (error)
LOG_ERROR(error);
}
// move the old source database into a new dir
*pSessionDir = generateSessionDirPath();
Error error = oldSourceDatabaseRoot().move(*pSessionDir);
if (error)
LOG_ERROR(error);
// if that failed we might still need to call ensureDirectory
error = pSessionDir->ensureDirectory();
if (error)
return error;
// attempt to acquire the lock. if we can't then we still continue
// so we can support filesystems that don't have file locks.
error = sessionDirLock().acquire(sessionLockFilePath(*pSessionDir));
if (error)
LOG_ERROR(error);
return Success();
}
示例4: createStandalonePresentation
Error createStandalonePresentation(const json::JsonRpcRequest& request,
json::JsonRpcResponse* pResponse)
{
std::string pathParam;
Error error = json::readParam(request.params, 0, &pathParam);
if (error)
return error;
FilePath targetPath = module_context::resolveAliasedPath(pathParam);
FilePath htmlFilePath = presentation::state::htmlFilePath();
ErrorResponse errorResponse;
if (!savePresentationAsStandalone(htmlFilePath, &errorResponse))
{
pResponse->setError(systemError(boost::system::errc::io_error,
ERROR_LOCATION),
json::toJsonString(errorResponse.message));
}
return htmlFilePath.move(targetPath);
}