本文整理汇总了C++中FilePath::setPath方法的典型用法代码示例。如果您正苦于以下问题:C++ FilePath::setPath方法的具体用法?C++ FilePath::setPath怎么用?C++ FilePath::setPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FilePath
的用法示例。
在下文中一共展示了FilePath::setPath方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: makeComponentFiles
// outDir ignored if writeToProject is true.
void CMaker::makeComponentFiles(bool writeToProject, OovStringRef const outDir,
OovStringVec const &compNames)
{
FilePath incMapFn(getAnalysisPath(), FP_Dir);
incMapFn.appendFile(Project::getAnalysisIncDepsFilename());
mIncMap.read(incMapFn);
if(mVerbose)
printf("Read incmap\n");
for(auto const &compName : compNames)
{
ComponentTypesFile::eCompTypes compType =
mCompTypes.getComponentType(compName);
if(compType != ComponentTypesFile::CT_Unknown)
{
OovStringVec sources = getCompSources(compName);
FilePath outFp;
std::string fixedCompName = makeComponentNameFromDir(compName);
if(writeToProject)
{
outFp.setPath(mCompTypes.getComponentAbsolutePath(
compName), FP_Dir);
outFp.appendFile("CMakeLists.txt");
}
else
{
outFp.setPath(outDir, FP_File);
outFp.appendFile(std::string(fixedCompName + "-CMakeLists.txt"));
}
// Using the filepath here gives:
// "Error evaluating generator expression", and "Target name not supported"
makeComponentFile(fixedCompName, compType,
sources, outFp);
}
}
}
示例2: setupCWD
void setupCWD()
{
#ifdef __GLIBC__
cwd.setPath(get_current_dir_name());
return;
#else // untested
const char *env = getenv("CWD");
if (env)
{
cwd.setPath(env);
return;
}
char buf[PATH_MAX + 1];
if (getcwd(buf, PATH_MAX))
{
cwd.setPath(buf);
}
#endif // __GLIBC__
}
示例3: main
int main(int argc, char * argv[])
{
int ret = 1;
bool verbose = false;
bool writeToProject = false;
const char *projDir = nullptr;
const char *projName = "PROJNAME";
for(int argi=1; argi<argc; argi++)
{
if(argv[argi][0] == '-')
{
switch(argv[argi][1])
{
case 'v':
verbose = true;
break;
case 'w':
writeToProject = true;
break;
case 'n':
projName = &argv[argi][2];
break;
}
}
else
projDir = argv[argi];
}
if(projDir)
{
Project::setProjectDirectory(projDir);
CMaker maker(projName, verbose);
FilePath outDir;
if(writeToProject)
{
outDir.setPath(Project::getSrcRootDirectory(), FP_Dir);
}
else
{
outDir.setPath(Project::getBuildOutputDir("CMake"), FP_Dir);
FileEnsurePathExists(outDir);
if(maker.mVerbose)
printf("Output directory %s\n", outDir.getStr());
}
if(maker.mCompTypes.read())
{
maker.makeToolchainFiles(outDir);
maker.makeTopLevelFiles(outDir);
maker.mBuildPkgs.read();
FilePath topMlFp(outDir, FP_File);
topMlFp.appendFile("CMakeLists.txt");
maker.makeTopMakelistsFile(topMlFp);
OovStringVec compNames = maker.mCompTypes.getComponentNames(true);
if(compNames.size() > 0)
{
maker.makeComponentFiles(writeToProject, outDir, compNames);
ret = 0;
}
else
fprintf(stderr, "Components must be defined\n");
}
else
fprintf(stderr, "Unable to read project files\n");
}
else
{
fprintf(stderr, "OovCMaker version %s\n", OOV_VERSION);
fprintf(stderr, " OovCMaker projectDirectory [switches]\n");
fprintf(stderr, " switches -v=verbose, -w=write to project, -nProjName\n");
}
return ret;
}