本文整理汇总了C++中StHandle::hasPath方法的典型用法代码示例。如果您正苦于以下问题:C++ StHandle::hasPath方法的具体用法?C++ StHandle::hasPath怎么用?C++ StHandle::hasPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StHandle
的用法示例。
在下文中一共展示了StHandle::hasPath方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int , char** ) { // force console output
#else
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { // prevent console output
#endif
setlocale(LC_ALL, ".OCP"); // we set default locale for console output (useful only for debug)
#else
int main(int , char** ) {
#endif
StOutPageFlip::initGlobalsAsync();
if(!StVersionInfo::checkTimeBomb("sView")) {
return 1;
}
// setup environment variables
const StString ST_ENV_NAME_STCORE_PATH =
#if defined(_WIN64) || defined(_LP64) || defined(__LP64__)
"StCore64";
#else
"StCore32";
#endif
const StString aProcessPath = StProcess::getProcessFolder();
StString aProcessUpPath = StFileNode::getFolderUp(aProcessPath);
if(!aProcessUpPath.isEmpty()) {
aProcessUpPath += SYS_FS_SPLITTER;
}
StProcess::setEnv(ST_ENV_NAME_STCORE_PATH, aProcessPath);
if(StFolder::isFolder(aProcessPath + "textures")) {
StProcess::setEnv("StShare", aProcessPath);
} else if(StFolder::isFolder(aProcessUpPath + "textures")) {
StProcess::setEnv("StShare", aProcessUpPath);
}
StString aResDir = StProcess::getStShareFolder();
StProcess::setEnv("CSF_UnitsLexicon", aResDir + "UnitsAPI" ST_FILE_SPLITTER "Lexi_Expr.dat");
StProcess::setEnv("CSF_UnitsDefinition", aResDir + "UnitsAPI" ST_FILE_SPLITTER "Units.dat");
StProcess::setEnv("CSF_ShadersDirectory", aResDir + "shaders" ST_FILE_SPLITTER "StCADViewer");
StProcess::setEnv("CSF_SHMessage", aResDir + "lang");
StProcess::setEnv("CSF_MDTVTexturesDirectory", aResDir + "textures");
StHandle<StOpenInfo> anInfo;
if(anInfo.isNull()
|| (!anInfo->hasPath() && !anInfo->hasArgs())) {
anInfo = StApplication::parseProcessArguments();
}
if(anInfo.isNull()) {
// show help
StString aShowHelpString = getAbout();
st::cout << aShowHelpString;
stInfo(aShowHelpString);
return 0;
}
StHandle<StResourceManager> aResMgr = new StResourceManager();
StHandle<StCADViewer> anApp = new StCADViewer(aResMgr, NULL, anInfo);
if(!anApp->open()) {
return 1;
}
return anApp->exec();
}
示例2: StOpenInfo
StHandle<StOpenInfo> StApplication::parseProcessArguments() {
StHandle<StOpenInfo> anInfo = new StOpenInfo();
StArrayList<StString> anArguments = StProcess::getArguments();
StArgumentsMap anOpenFileArgs;
size_t aFilesCount = 0;
bool isFilesSection = false;
const StString ARGUMENT_FILES_SECTION = '-';
const StString ARGUMENT_ANY = "--";
const StString ARGUMENT_HELP = "help";
const StString ARGUMENT_FILE = "file";
const StString ARGUMENT_LEFT_VIEW = "left";
const StString ARGUMENT_RIGHT_VIEW = "right";
// parse extra parameters
for(size_t aParamIter = 1; aParamIter < anArguments.size(); ++aParamIter) {
StString aParam = anArguments[aParamIter];
///ST_DEBUG_LOG("aParam= '" + aParam + "'");
if(isFilesSection) {
// file name
StString aFilePath = StProcess::getAbsolutePath(aParam);
anOpenFileArgs.add(StArgument(ARGUMENT_FILE + aFilesCount++, aFilePath));
if(!anInfo->hasPath()) {
// first file determines MIME type (needed to autoselect Drawer plugin)
anInfo->setPath(aFilePath);
}
} else if(aParam == ARGUMENT_FILES_SECTION) {
isFilesSection = true;
} else if(aParam.isStartsWith(ARGUMENT_ANY)) {
// argument
StArgument anArg; anArg.parseString(aParam.subString(2, aParam.getLength())); // cut suffix --
if(anArg.getKey().isEqualsIgnoreCase(ARGUMENT_HELP)) {
return NULL;
} else if(anArg.getKey().isEqualsIgnoreCase(ARGUMENT_LEFT_VIEW)) {
// left view
anArg.setValue(StProcess::getAbsolutePath(anArg.getValue()));
anOpenFileArgs.add(anArg);
anInfo->setPath(anArg.getValue()); // left file always determines MIME type
} else if(anArg.getKey().isEqualsIgnoreCase(ARGUMENT_RIGHT_VIEW)) {
// right view
anArg.setValue(StProcess::getAbsolutePath(anArg.getValue()));
anOpenFileArgs.add(anArg);
if(!anInfo->hasPath()) {
anInfo->setPath(anArg.getValue());
}
} else {
// pass argument unchanged
anOpenFileArgs.add(anArg);
}
} else {
// file name
StString aFilePath = StProcess::getAbsolutePath(aParam);
anOpenFileArgs.add(StArgument(ARGUMENT_FILE + aFilesCount++, aFilePath));
if(!anInfo->hasPath()) {
// first file determines MIME type (needed to autoselect Drawer plugin)
anInfo->setPath(aFilePath);
}
}
}
anInfo->setArgumentsMap(anOpenFileArgs);
return anInfo;
}