本文整理汇总了C++中Path::ReplaceExtension方法的典型用法代码示例。如果您正苦于以下问题:C++ Path::ReplaceExtension方法的具体用法?C++ Path::ReplaceExtension怎么用?C++ Path::ReplaceExtension使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Path
的用法示例。
在下文中一共展示了Path::ReplaceExtension方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetDestFileName
String CTransformationThread::GetDestFileName(size_t index) const
{
ASSERT(index < files_.size());
PhotoInfo& photo= *files_[index];
Path output;
if (params_.use_src_path_ == TransformationParams::USE_SRC_PATH)
{
output = photo.GetOriginalPath();
if (!params_.suffix_.empty())
output.AppendToFileName(params_.suffix_.c_str());
if (!params_.dest_file_extension_.empty())
output.ReplaceExtension(params_.dest_file_extension_.c_str());
}
else if (params_.use_src_path_ == TransformationParams::USE_DEST_PATH)
{
output = params_.dest_path_;
Path name= photo.GetOriginalPath().GetFileNameAndExt();
if (!params_.suffix_.empty())
name.AppendToFileName(params_.suffix_.c_str());
if (!params_.dest_file_extension_.empty())
name.ReplaceExtension(params_.dest_file_extension_.c_str());
output.AppendDir(name.c_str(), false);
}
else
{
ASSERT(params_.use_src_path_ == TransformationParams::USE_GIVEN_FILENAME);
output = params_.dest_file_;
}
ASSERT(!output.empty());
return output;
}
示例2: BuildModule
void BuildTool::BuildModule( const std::vector<FileToBuild>& buildFileList,
const std::vector<FileSystemUtils::Path>& includeDirList,
const std::vector<FileSystemUtils::Path>& libraryDirList,
const std::vector<FileSystemUtils::Path>& linkLibraryList,
const char* pCompileOptions,
const char* pLinkOptions,
const FileSystemUtils::Path& moduleName )
{
// Initial version is very basic, simply compiles them.
Path objectFileExtension = m_Compiler.GetObjectFileExtension();
vector<Path> compileFileList; // List of files we pass to the compiler
compileFileList.reserve( buildFileList.size() );
vector<Path> forcedCompileFileList; // List of files which must be compiled even if object file exists
vector<Path> nonForcedCompileFileList; // List of files which can be linked if already compiled
// Seperate into seperate file lists of force and non-forced,
// so we can ensure we don't have the same file in both
for( size_t i = 0; i < buildFileList.size(); ++i )
{
Path buildFile = buildFileList[i].filePath;
if( buildFileList[i].forceCompile )
{
if( find( forcedCompileFileList.begin(), forcedCompileFileList.end(), buildFile ) == forcedCompileFileList.end() )
{
forcedCompileFileList.push_back( buildFile );
}
}
else
{
if( find( nonForcedCompileFileList.begin(), nonForcedCompileFileList.end(), buildFile ) == nonForcedCompileFileList.end() )
{
nonForcedCompileFileList.push_back( buildFile );
}
}
}
// Add all forced compile files to build list
for( size_t i = 0; i < forcedCompileFileList.size(); ++i )
{
compileFileList.push_back( forcedCompileFileList[i] );
}
// Add non forced files, but only if they don't exist in forced compile list
Path runtimeFolder = m_Compiler.GetRuntimeIntermediatePath();
for( size_t i = 0; i < nonForcedCompileFileList.size(); ++i )
{
Path buildFile = nonForcedCompileFileList[i];
if( find( forcedCompileFileList.begin(), forcedCompileFileList.end(), buildFile ) == forcedCompileFileList.end() )
{
// Check if we have a pre-compiled object version of this file, and if so use that.
Path objectFileName = runtimeFolder/buildFile.Filename();
objectFileName.ReplaceExtension(objectFileExtension.c_str());
if( objectFileName.Exists() && buildFile.Exists() )
{
FileSystemUtils::filetime_t objTime = objectFileName.GetLastWriteTime();
if( objTime > m_InitTime && objTime > buildFile.GetLastWriteTime() )
{
// we only want to use the object file if it's newer than our start-up time so
// we know it's from the current session (so likely compiled with same settings),
// and it's newer than the source file
buildFile = objectFileName;
}
}
compileFileList.push_back(buildFile);
}
}
m_Compiler.RunCompile( compileFileList, includeDirList, libraryDirList, linkLibraryList, pCompileOptions, pLinkOptions, moduleName );
}
示例3: BuildModule
void BuildTool::BuildModule( const std::vector<FileToBuild>& buildFileList_,
const CompilerOptions& compilerOptions_,
std::vector<FileSystemUtils::Path> linkLibraryList_,
const FileSystemUtils::Path& moduleName_ )
{
// Initial version is very basic, simply compiles them.
Path objectFileExtension = m_Compiler.GetObjectFileExtension();
vector<Path> compileFileList; // List of files we pass to the compiler
compileFileList.reserve( buildFileList_.size() );
vector<Path> forcedCompileFileList; // List of files which must be compiled even if object file exists
vector<Path> nonForcedCompileFileList; // List of files which can be linked if already compiled
// Seperate into seperate file lists of force and non-forced,
// so we can ensure we don't have the same file in both
for( size_t i = 0; i < buildFileList_.size(); ++i )
{
Path buildFile = buildFileList_[i].filePath;
if( buildFileList_[i].forceCompile )
{
if( find( forcedCompileFileList.begin(), forcedCompileFileList.end(), buildFile ) == forcedCompileFileList.end() )
{
forcedCompileFileList.push_back( buildFile );
}
}
else
{
if( find( nonForcedCompileFileList.begin(), nonForcedCompileFileList.end(), buildFile ) == nonForcedCompileFileList.end() )
{
nonForcedCompileFileList.push_back( buildFile );
}
}
}
// Add all forced compile files to build list
for( size_t i = 0; i < forcedCompileFileList.size(); ++i )
{
compileFileList.push_back( forcedCompileFileList[i] );
}
// runtime folder needs to be aware of compilation level and debug/
// Add non forced files, but only if they don't exist in forced compile list
for( size_t i = 0; i < nonForcedCompileFileList.size(); ++i )
{
Path buildFile = nonForcedCompileFileList[i];
if( find( forcedCompileFileList.begin(), forcedCompileFileList.end(), buildFile ) == forcedCompileFileList.end() )
{
// Check if we have a pre-compiled object version of this file, and if so use that.
Path objectFileName = compilerOptions_.intermediatePath / buildFile.Filename();
objectFileName.ReplaceExtension(objectFileExtension.c_str());
if( objectFileName.Exists() && buildFile.Exists() )
{
FileSystemUtils::filetime_t objTime = objectFileName.GetLastWriteTime();
if( objTime > buildFile.GetLastWriteTime() )
{
// we only want to use the object file if it's newer than the source file
buildFile = objectFileName;
}
}
compileFileList.push_back(buildFile);
}
}
m_Compiler.RunCompile( compileFileList, compilerOptions_, linkLibraryList_, moduleName_ );
}