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


C++ FilePath::move方法代码示例

本文整理汇总了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() ;
}
开发者ID:lionelc,项目名称:rstudio,代码行数:30,代码来源:SessionFiles.cpp

示例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() ;
}
开发者ID:rlugojr,项目名称:rstudio,代码行数:28,代码来源:SessionFiles.cpp

示例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();
}
开发者ID:cprosser,项目名称:rstudio,代码行数:31,代码来源:SessionSourceDatabaseSupervisor.cpp

示例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);
}
开发者ID:edrogers,项目名称:rstudio,代码行数:20,代码来源:SessionPresentation.cpp


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