mirror of https://github.com/axmolengine/axmol.git
Merge pull request #15130 from chengstory/AddUseLocalScriptCommand
Add "-use-local-script" command param. It's OK for me, merged.
This commit is contained in:
commit
8bf3d33c09
|
@ -50,6 +50,7 @@ ProjectConfig::ProjectConfig()
|
||||||
, _consolePort(kProjectConfigConsolePort)
|
, _consolePort(kProjectConfigConsolePort)
|
||||||
, _fileUploadPort(kProjectConfigUploadPort)
|
, _fileUploadPort(kProjectConfigUploadPort)
|
||||||
, _bindAddress("")
|
, _bindAddress("")
|
||||||
|
, _useLocalScript(false)
|
||||||
{
|
{
|
||||||
normalize();
|
normalize();
|
||||||
}
|
}
|
||||||
|
@ -272,6 +273,17 @@ void ProjectConfig::setDebuggerType(int debuggerType)
|
||||||
_debuggerType = debuggerType;
|
_debuggerType = debuggerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ProjectConfig::isUseLocalScript() const
|
||||||
|
{
|
||||||
|
return _useLocalScript;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ProjectConfig::setUseLocalScript(bool useLocalScript)
|
||||||
|
{
|
||||||
|
_useLocalScript = useLocalScript;
|
||||||
|
}
|
||||||
|
|
||||||
void ProjectConfig::parseCommandLine(const vector<string> &args)
|
void ProjectConfig::parseCommandLine(const vector<string> &args)
|
||||||
{
|
{
|
||||||
auto it = args.begin();
|
auto it = args.begin();
|
||||||
|
@ -409,7 +421,19 @@ void ProjectConfig::parseCommandLine(const vector<string> &args)
|
||||||
vector<string> pathes = split((*it), ';');
|
vector<string> pathes = split((*it), ';');
|
||||||
setSearchPath(pathes);
|
setSearchPath(pathes);
|
||||||
}
|
}
|
||||||
|
else if (arg.compare("-use-local-script") == 0)
|
||||||
|
{
|
||||||
|
++it;
|
||||||
|
if (it == args.end()) break;
|
||||||
|
if ((*it).compare("enable") == 0)
|
||||||
|
{
|
||||||
|
setUseLocalScript(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setUseLocalScript(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -572,6 +596,19 @@ vector<string> ProjectConfig::makeCommandLineVector(unsigned int mask /* = kProj
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mask & kProjectConfigUseLocalScript)
|
||||||
|
{
|
||||||
|
if (isUseLocalScript())
|
||||||
|
{
|
||||||
|
ret.push_back("-use-local-script");
|
||||||
|
ret.push_back("enable");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ret.push_back("-use-local-script");
|
||||||
|
ret.push_back("disable");
|
||||||
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ using namespace std;
|
||||||
#define kProjectConfigDebugger 1024 // -debugger-ldt, -debugger-codeide, -disable-debugger
|
#define kProjectConfigDebugger 1024 // -debugger-ldt, -debugger-codeide, -disable-debugger
|
||||||
#define kProjectConfigListen 2048 //
|
#define kProjectConfigListen 2048 //
|
||||||
#define kProjectConfigSearchPath 4096 //
|
#define kProjectConfigSearchPath 4096 //
|
||||||
|
#define kProjectConfigUseLocalScript 8192 // -use-local-script
|
||||||
|
|
||||||
#define kProjectConfigOpenRecent (kProjectConfigProjectDir | kProjectConfigScriptFile | kProjectConfigPackagePath | kProjectConfigWritablePath | kProjectConfigFrameSize | kProjectConfigFrameScale | kProjectConfigShowConsole | kProjectConfigLoadPrecompiledFramework | kProjectConfigWriteDebugLogToFile)
|
#define kProjectConfigOpenRecent (kProjectConfigProjectDir | kProjectConfigScriptFile | kProjectConfigPackagePath | kProjectConfigWritablePath | kProjectConfigFrameSize | kProjectConfigFrameScale | kProjectConfigShowConsole | kProjectConfigLoadPrecompiledFramework | kProjectConfigWriteDebugLogToFile)
|
||||||
|
|
||||||
|
@ -105,6 +106,9 @@ public:
|
||||||
void setSearchPath(const vector<string> &args);
|
void setSearchPath(const vector<string> &args);
|
||||||
const vector<string> &getSearchPath() const;
|
const vector<string> &getSearchPath() const;
|
||||||
|
|
||||||
|
bool isUseLocalScript() const;
|
||||||
|
void setUseLocalScript(bool useLocalScript);
|
||||||
|
|
||||||
bool isAppMenu() const;
|
bool isAppMenu() const;
|
||||||
bool isResizeWindow() const;
|
bool isResizeWindow() const;
|
||||||
bool isRetinaDisplay() const;
|
bool isRetinaDisplay() const;
|
||||||
|
@ -133,6 +137,7 @@ private:
|
||||||
int _fileUploadPort;
|
int _fileUploadPort;
|
||||||
string _bindAddress;
|
string _bindAddress;
|
||||||
vector<string> _searchPath;
|
vector<string> _searchPath;
|
||||||
|
bool _useLocalScript;
|
||||||
|
|
||||||
void normalize();
|
void normalize();
|
||||||
string replaceProjectDirToMacro(const string &path) const;
|
string replaceProjectDirToMacro(const string &path) const;
|
||||||
|
|
|
@ -223,8 +223,12 @@ void RuntimeEngine::setProjectPath(const std::string &workPath)
|
||||||
g_projectPath = workPath;
|
g_projectPath = workPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_project.isUseLocalScript())
|
||||||
|
{
|
||||||
// add project's root directory to search path
|
// add project's root directory to search path
|
||||||
searchPathArray.insert(searchPathArray.begin(), g_projectPath);
|
searchPathArray.insert(searchPathArray.begin(), g_projectPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// add writable path to search path
|
// add writable path to search path
|
||||||
searchPathArray.insert(searchPathArray.begin(), FileServer::getShareInstance()->getWritePath());
|
searchPathArray.insert(searchPathArray.begin(), FileServer::getShareInstance()->getWritePath());
|
||||||
|
|
Loading…
Reference in New Issue