diff --git a/templates/js-template-default/frameworks/runtime-src/Classes/Runtime.cpp b/templates/js-template-default/frameworks/runtime-src/Classes/Runtime.cpp index a4268f8150..4213689ba0 100644 --- a/templates/js-template-default/frameworks/runtime-src/Classes/Runtime.cpp +++ b/templates/js-template-default/frameworks/runtime-src/Classes/Runtime.cpp @@ -538,11 +538,11 @@ bool FileServer::recv_file(int fd) { char buffer[1024]={0}; char namelen[4]={0}; - if (read(fd, namelen, 4)<=0) { + if (recv(fd, namelen, 4,0)<=0) { return false; } - if (read(fd, buffer, atoi(namelen))<=0) { + if (recv(fd, buffer, atoi(namelen),0)<=0) { return false; } @@ -556,7 +556,7 @@ bool FileServer::recv_file(int fd) FILE *fp =fopen(fullfilename, "wb"); int length =0; - while ((length=read(fd, fullfilename, sizeof(fullfilename))) > 0) { + while ((length=recv(fd, fullfilename, sizeof(fullfilename),0)) > 0) { fwrite(fullfilename, sizeof(char), length,fp); } fclose(fp); @@ -656,7 +656,7 @@ class ConsoleCustomCommand public: ConsoleCustomCommand():_fileserver(nullptr) { - + _writepath = FileUtils::getInstance()->getWritablePath(); cocos2d::Console *_console = Director::getInstance()->getConsole(); static struct Console::Command commands[] = { {"shutdownapp","exit runtime app",std::bind(&ConsoleCustomCommand::onShutDownApp, this, std::placeholders::_1, std::placeholders::_2)}, @@ -684,12 +684,11 @@ class ConsoleCustomCommand void onPreCompile(int fd, const std::string &args) { - Director::getInstance()->getScheduler()->performFunctionInCocosThread([](){ - string jsSearchPath= FileUtils::getInstance()->getWritablePath(); - vector fileInfoList = searchFileList(jsSearchPath,"*.js","runtime|framework|"); + Director::getInstance()->getScheduler()->performFunctionInCocosThread([=](){ + vector fileInfoList = searchFileList(_writepath,"*.js","runtime|frameworks|"); for (unsigned i = 0; i < fileInfoList.size(); i++) { - ScriptingCore::getInstance()->compileScript(fileInfoList[i].substr(jsSearchPath.length(),-1).c_str()); + ScriptingCore::getInstance()->compileScript(fileInfoList[i].substr(_writepath.length(),-1).c_str()); } }); } @@ -716,7 +715,7 @@ class ConsoleCustomCommand } private: FileServer* _fileserver; - + string _writepath; }; void startRuntime() diff --git a/templates/js-template-default/frameworks/runtime-src/proj.android/AndroidManifest.xml b/templates/js-template-default/frameworks/runtime-src/proj.android/AndroidManifest.xml index c27d8bf68b..20c2ec740e 100644 --- a/templates/js-template-default/frameworks/runtime-src/proj.android/AndroidManifest.xml +++ b/templates/js-template-default/frameworks/runtime-src/proj.android/AndroidManifest.xml @@ -14,7 +14,7 @@ android:label="@string/app_name" android:screenOrientation="landscape" android:theme="@android:style/Theme.NoTitleBar.Fullscreen" - android:configChanges="orientation|screenSize|smallestScreenSize"> + android:configChanges="orientation">