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


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

本文整理汇总了C++中FilePath::lastWriteTime方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::lastWriteTime方法的具体用法?C++ FilePath::lastWriteTime怎么用?C++ FilePath::lastWriteTime使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FilePath的用法示例。


在下文中一共展示了FilePath::lastWriteTime方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setCacheableFile

 void setCacheableFile(const FilePath& filePath, 
                       const Request& request, 
                       const Filter& filter)
 {
    // ensure that the file exists
    if (!filePath.exists())
    {
       setError(http::status::NotFound, request.uri() + " not found");
       return;
    }
    
    // set Last-Modified
    using namespace boost::posix_time;
    ptime lastModifiedDate = from_time_t(filePath.lastWriteTime());
    setHeader("Last-Modified", util::httpDate(lastModifiedDate));
    
    // compare file modified time to If-Modified-Since
    if (lastModifiedDate == request.ifModifiedSince())
    {
       removeHeader("Content-Type"); // upstream code may have set this
       setStatusCode(status::NotModified);
    }
    else
    {
       setFile(filePath, request, filter);
    }
 }
开发者ID:AndreMikulec,项目名称:rstudio,代码行数:27,代码来源:Response.hpp

示例2: projectFromDirectory

FilePath projectFromDirectory(const FilePath& directoryPath)
{
   // first use simple heuristic of a case sentitive match between
   // directory name and project file name
   FilePath projectFile = directoryPath.childPath(
                                       directoryPath.filename() + ".Rproj");
   if (projectFile.exists())
      return projectFile;

   // didn't satisfy it with simple check so do scan of directory
   std::vector<FilePath> children;
   Error error = directoryPath.children(&children);
   if (error)
   {
      LOG_ERROR(error);
      return FilePath();
   }

   // build a vector of children with .rproj extensions. at the same
   // time allow for a case insensitive match with dir name and return that
   std::string projFileLower = string_utils::toLower(projectFile.filename());
   std::vector<FilePath> rprojFiles;
   for (std::vector<FilePath>::const_iterator it = children.begin();
        it != children.end();
        ++it)
   {
      if (!it->isDirectory() && (it->extensionLowerCase() == ".rproj"))
      {
         if (string_utils::toLower(it->filename()) == projFileLower)
            return *it;
         else
            rprojFiles.push_back(*it);
      }
   }

   // if we found only one rproj file then return it
   if (rprojFiles.size() == 1)
   {
      return rprojFiles.at(0);
   }
   // more than one, take most recent
   else if (rprojFiles.size() > 1 )
   {
      projectFile = rprojFiles.at(0);
      for (std::vector<FilePath>::const_iterator it = rprojFiles.begin();
           it != rprojFiles.end();
           ++it)
      {
         if (it->lastWriteTime() > projectFile.lastWriteTime())
            projectFile = *it;
      }

      return projectFile;
   }
   // didn't find one
   else
   {
      return FilePath();
   }
}
开发者ID:harupiko,项目名称:rstudio,代码行数:60,代码来源:RProjectFile.cpp

示例3: recordSourcedFile

void SourceManager::recordSourcedFile(const FilePath& filePath, bool local)
{
   SourcedFileInfo fileInfo(filePath.lastWriteTime(), local); 
   sourcedFiles_[filePath.absolutePath()] = fileInfo ;
}
开发者ID:AndreMikulec,项目名称:rstudio,代码行数:5,代码来源:RSourceManager.cpp


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