bool ProjectConfig::validate(void) { CCFileUtils *utils = CCFileUtils::sharedFileUtils(); if (!utils->isDirectoryExist(m_projectDir)) return false; if (!utils->isDirectoryExist(getWritableRealPath())) return false; if (!utils->isFileExist(getScriptFileRealPath())) return false; return true; }
bool ProjectConfig::validate() const { auto utils = cocos2d::FileUtils::getInstance(); if (!utils->isDirectoryExist(_projectDir)) return false; if (!utils->isDirectoryExist(getWritableRealPath())) return false; if (!utils->isFileExist(getScriptFileRealPath())) return false; return true; }
const string ProjectConfig::makeCommandLine(unsigned int mask /* = kProjectConfigAll */) { stringstream buff; if (mask & kProjectConfigQuickRootPath) { const string path = SimulatorConfig::sharedDefaults()->getQuickCocos2dxRootPath(); if (path.length()) { buff << " -quick "; buff << path; } } if (mask & kProjectConfigProjectDir) { const string path = getProjectDir(); if (path.length()) { buff << " -workdir "; buff << path; } } if (mask & kProjectConfigScriptFile) { const string path = getScriptFileRealPath(); if (path.length()) { buff << " -file "; buff << path; } } if (mask & kProjectConfigWritablePath) { const string path = getWritableRealPath(); if (path.length()) { buff << " -writable "; buff << path; } } if (mask & kProjectConfigPackagePath) { const string packagePath = getPackagePath(); if (packagePath.length()) { buff << " -package.path "; buff << packagePath; } } if (mask & kProjectConfigFrameSize) { buff << " -size "; buff << (int)getFrameSize().width; buff << "x"; buff << (int)getFrameSize().height; } if (mask & kProjectConfigFrameScale) { if (getFrameScale() < 1.0f) { buff << " -scale "; buff.precision(2); buff << getFrameScale(); } } if (mask & kProjectConfigWriteDebugLogToFile) { if (isWriteDebugLogToFile()) { buff << " -write-debug-log"; } else { buff << " -disable-write-debug-log"; } } if (mask & kProjectConfigShowConsole) { if (isShowConsole()) { buff << " -console"; } else { buff << " -disable-console"; } } if (mask & kProjectConfigLoadPrecompiledFramework) { if (isLoadPrecompiledFramework()) { buff << " -load-framework"; } else { buff << " -disable-load-framework"; } } if (mask & kProjectConfigWindowOffset) { if (m_windowOffset.x != 0 && m_windowOffset.y != 0) { buff << " -offset {"; buff << (int)m_windowOffset.x; buff << ","; buff << (int)m_windowOffset.y; buff << "}"; } } if (mask & kProjectConfigDebugger) { switch (getDebuggerType()) { case kCCLuaDebuggerLDT: buff << " -debugger-ldt"; break; case kCCLuaDebuggerNone: default: buff << " -disable-debugger"; } } return buff.str(); }
vector<string> ProjectConfig::makeCommandLineVector(unsigned int mask /* = kProjectConfigAll */) const { vector<string> ret; stringstream buff; if (mask & kProjectConfigProjectDir) { auto path = getProjectDir(); if (path.length()) { ret.push_back("-workdir"); ret.push_back(dealWithSpaceWithPath(path)); } } if (mask & kProjectConfigScriptFile) { auto path = getScriptFileRealPath(); if (path.length()) { ret.push_back("-entry"); ret.push_back(dealWithSpaceWithPath(path)); } } if (mask & kProjectConfigWritablePath) { auto path = getWritableRealPath(); if (path.length()) { ret.push_back("-writable-path"); ret.push_back(dealWithSpaceWithPath(path)); } } if (mask & kProjectConfigFrameSize) { buff.str(""); buff << (int)getFrameSize().width; buff << "x"; buff << (int)getFrameSize().height; ret.push_back("-resolution"); ret.push_back(buff.str()); } if (mask & kProjectConfigFrameScale) { if (getFrameScale() < 1.0f) { buff.str(""); buff.precision(2); buff << getFrameScale(); ret.push_back("-scale"); ret.push_back(buff.str()); } } if (mask & kProjectConfigWriteDebugLogToFile) { if (isWriteDebugLogToFile()) { ret.push_back("-write-debug-log"); ret.push_back(getDebugLogFilePath()); } } if (mask & kProjectConfigShowConsole) { if (isShowConsole()) { ret.push_back("-console"); ret.push_back("enable"); } else { ret.push_back("-console"); ret.push_back("disable"); } } if (mask & kProjectConfigWindowOffset) { if (_windowOffset.x != 0 && _windowOffset.y != 0) { buff.str(""); buff << (int)_windowOffset.x; buff << ","; buff << (int)_windowOffset.y; buff << ""; ret.push_back("-position"); ret.push_back(buff.str()); } } if (mask & kProjectConfigDebugger) { switch (getDebuggerType()) { case kCCRuntimeDebuggerCodeIDE: ret.push_back("-debugger"); ret.push_back("codeide"); break; case kCCRuntimeDebuggerStudio: ret.push_back("-debugger"); ret.push_back("studio"); break; } } if (mask & kProjectConfigListen) { if (!_bindAddress.empty()) { ret.push_back("-listen"); ret.push_back(_bindAddress); } } if (mask & kProjectConfigSearchPath) { if (_searchPath.size() > 0) { stringstream pathbuff; for (auto &path : _searchPath) { pathbuff << dealWithSpaceWithPath(path) << ";"; } string pathArgs = pathbuff.str(); pathArgs[pathArgs.length()-1] = '\0'; ret.push_back("-search-path"); ret.push_back(pathArgs); } } if (mask & kProjectConfigFirstSearchPath) { if (_searchPath.size() > 0) { stringstream pathbuff; for (auto &path : _searchPath) { pathbuff << dealWithSpaceWithPath(path) << ";"; } string pathArgs = pathbuff.str(); pathArgs[pathArgs.length() - 1] = '\0'; ret.push_back("-first-search-path"); ret.push_back(pathArgs); } } return ret; }