Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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);
Expand Down Expand Up @@ -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)},
Expand Down Expand Up @@ -684,12 +684,11 @@ class ConsoleCustomCommand

void onPreCompile(int fd, const std::string &args)
{
Director::getInstance()->getScheduler()->performFunctionInCocosThread([](){
string jsSearchPath= FileUtils::getInstance()->getWritablePath();
vector<std::string> fileInfoList = searchFileList(jsSearchPath,"*.js","runtime|framework|");
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=](){
vector<std::string> 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());
}
});
}
Expand All @@ -716,7 +715,7 @@ class ConsoleCustomCommand
}
private:
FileServer* _fileserver;

string _writepath;
};

void startRuntime()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<!-- Tell NativeActivity the name of our .so -->
<meta-data android:name="android.app.lib_name"
Expand Down
14 changes: 7 additions & 7 deletions templates/js-template-default/js-template-default.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
"frameworks/runtime-src/proj.win32/PROJECT_NAME.sln",
"frameworks/runtime-src/proj.win32/main.cpp",
"frameworks/runtime-src/proj.win32/Runtime_win32.cpp",
"frameworks/runtime-src/proj.anroid/.project",
"frameworks/runtime-src/proj.anroid/.cproject",
"frameworks/runtime-src/proj.anroid/AndroidManifest.xml",
"frameworks/runtime-src/proj.anroid/build.xml",
"frameworks/runtime-src/proj.anroid/build_native.sh",
"frameworks/runtime-src/proj.anroid/build_native.cmd",
"frameworks/runtime-src/proj.anroid/res/values/strings.xml",
"frameworks/runtime-src/proj.android/.project",
"frameworks/runtime-src/proj.android/.cproject",
"frameworks/runtime-src/proj.android/AndroidManifest.xml",
"frameworks/runtime-src/proj.android/build.xml",
"frameworks/runtime-src/proj.android/build_native.sh",
"frameworks/runtime-src/proj.android/build_native.cmd",
"frameworks/runtime-src/proj.android/res/values/strings.xml",
"frameworks/runtime-src/proj.ios_mac/Info.plist",
"frameworks/runtime-src/proj.ios_mac/ios/main.m",
"frameworks/runtime-src/proj.ios_mac/ios/Prefix.pch",
Expand Down