From 0a9ec91d6c446ab73bbdbc66cb9c5023be9db83b Mon Sep 17 00:00:00 2001 From: chuanweizhang2013 Date: Sat, 15 Mar 2014 18:13:29 +0800 Subject: [PATCH 1/7] init Console variable --- cocos/base/CCConsole.cpp | 8 ++++---- cocos/base/CCConsole.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 99b37ae047..2749d7eb3c 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -252,6 +252,8 @@ Console::Console() , _running(false) , _endThread(false) , _sendDebugStrings(false) +,_file_uploading(false) +,_upload_file_size(0) { // VS2012 doesn't support initializer list, so we create a new array and assign its elements to '_command'. Command commands[] = { @@ -290,6 +292,7 @@ Console::Console() { _commands.insert ( std::pair(commands[i].name,commands[i]) ); } + _writablePath = FileUtils::getInstance()->getWritablePath(); } Console::~Console() @@ -853,10 +856,7 @@ ssize_t Console::readfile(int fd, std::string& file_name, int file_size) ssize_t n, rc; char c; - auto sharedFileUtils = FileUtils::getInstance(); - - std::string writablePath = sharedFileUtils->getWritablePath(); - std::string fileName = writablePath+file_name; + std::string fileName = _writablePath+file_name; FILE* fp = fopen(fileName.c_str(), "wb"); if(!fp) diff --git a/cocos/base/CCConsole.h b/cocos/base/CCConsole.h index 848e9b91fa..d3ad6b4486 100644 --- a/cocos/base/CCConsole.h +++ b/cocos/base/CCConsole.h @@ -131,6 +131,7 @@ protected: bool _file_uploading; ssize_t _upload_file_size; std::string _upload_file_name; + std::string _writablePath; std::map _commands; From 9167d3995962a6699cbb86740df4151e075c662c Mon Sep 17 00:00:00 2001 From: chuanweizhang2013 Date: Sat, 15 Mar 2014 18:18:56 +0800 Subject: [PATCH 2/7] space --- cocos/base/CCConsole.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/base/CCConsole.h b/cocos/base/CCConsole.h index d3ad6b4486..bae7599d04 100644 --- a/cocos/base/CCConsole.h +++ b/cocos/base/CCConsole.h @@ -131,7 +131,7 @@ protected: bool _file_uploading; ssize_t _upload_file_size; std::string _upload_file_name; - std::string _writablePath; + std::string _writablePath; std::map _commands; From ec6c4ddf6419daccc91e29d7a20b1121b1d8350c Mon Sep 17 00:00:00 2001 From: chuanweizhang2013 Date: Sat, 15 Mar 2014 18:28:42 +0800 Subject: [PATCH 3/7] modify recv namelen array --- .../frameworks/runtime-src/Classes/Runtime.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/lua-template-runtime/frameworks/runtime-src/Classes/Runtime.cpp b/templates/lua-template-runtime/frameworks/runtime-src/Classes/Runtime.cpp index 5fc3dc5d2f..b0cb758961 100644 --- a/templates/lua-template-runtime/frameworks/runtime-src/Classes/Runtime.cpp +++ b/templates/lua-template-runtime/frameworks/runtime-src/Classes/Runtime.cpp @@ -363,7 +363,7 @@ bool CreateDir(const char *sPathName) bool FileServer::recv_file(int fd) { char buffer[1024]={0}; - char namelen[4]={0}; + char namelen[5]={0}; if (recv(fd, namelen, 4,0)<=0) { return false; } From 295bf7f7f22028537d8e3233332a3cd4d0b420bb Mon Sep 17 00:00:00 2001 From: chuanweizhang2013 Date: Mon, 17 Mar 2014 11:06:50 +0800 Subject: [PATCH 4/7] rename variable --- cocos/base/CCConsole.cpp | 16 ++++++++-------- cocos/base/CCConsole.h | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cocos/base/CCConsole.cpp b/cocos/base/CCConsole.cpp index 2749d7eb3c..3a2b5c76c7 100644 --- a/cocos/base/CCConsole.cpp +++ b/cocos/base/CCConsole.cpp @@ -252,8 +252,8 @@ Console::Console() , _running(false) , _endThread(false) , _sendDebugStrings(false) -,_file_uploading(false) -,_upload_file_size(0) +,_fileUploading(false) +,_uploadFileSize(0) { // VS2012 doesn't support initializer list, so we create a new array and assign its elements to '_command'. Command commands[] = { @@ -762,9 +762,9 @@ void Console::commandUpload(int fd, const std::string& args) auto argv = split(args,' '); if(argv.size() == 2) { - _upload_file_name = argv[0]; - _upload_file_size = std::atoi(argv[1].c_str()); - _file_uploading = true; + _uploadFileName = argv[0]; + _uploadFileSize = std::atoi(argv[1].c_str()); + _fileUploading = true; } else { @@ -970,7 +970,7 @@ void Console::loop() for(const auto &fd: _fds) { if(FD_ISSET(fd,©_set)) { - if(!_file_uploading) + if(!_fileUploading) { if( ! parseCommand(fd) ) { @@ -979,8 +979,8 @@ void Console::loop() } else { - readfile(fd, _upload_file_name, _upload_file_size); - _file_uploading = false; + readfile(fd, _uploadFileName, _uploadFileSize); + _fileUploading = false; } if(--nready <= 0) diff --git a/cocos/base/CCConsole.h b/cocos/base/CCConsole.h index bae7599d04..0d367a8d7c 100644 --- a/cocos/base/CCConsole.h +++ b/cocos/base/CCConsole.h @@ -128,9 +128,9 @@ protected: bool _running; bool _endThread; - bool _file_uploading; - ssize_t _upload_file_size; - std::string _upload_file_name; + bool _fileUploading; + ssize_t _uploadFileSize; + std::string _uploadFileName; std::string _writablePath; std::map _commands; From 86569cf456d0b0d2d7d491f04546ecf4f0988699 Mon Sep 17 00:00:00 2001 From: minggo Date: Mon, 17 Mar 2014 11:27:13 +0800 Subject: [PATCH 5/7] [ci skip] --- CHANGELOG.REMOVED.git-id | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.REMOVED.git-id b/CHANGELOG.REMOVED.git-id index 99cb9b0f5e..e90f414efd 100644 --- a/CHANGELOG.REMOVED.git-id +++ b/CHANGELOG.REMOVED.git-id @@ -1 +1 @@ -874372f8d3779318a2f70b74984575e632ff0dc8 \ No newline at end of file +936b6bad063ed7529710ca0edf9290b051097b23 \ No newline at end of file From 7fd3017b5f2df3b9c94d97d137167012e3004d22 Mon Sep 17 00:00:00 2001 From: CocosRobot Date: Mon, 17 Mar 2014 11:49:18 +0800 Subject: [PATCH 6/7] modify autotest.py for use mac app. --- tools/jenkins-scripts/autotest.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/jenkins-scripts/autotest.py b/tools/jenkins-scripts/autotest.py index 5ade2a4e34..86fb929a7c 100755 --- a/tools/jenkins-scripts/autotest.py +++ b/tools/jenkins-scripts/autotest.py @@ -1,3 +1,4 @@ +#!/usr/bin/python import os import sys import subprocess @@ -25,7 +26,7 @@ def autotest(type): soc.connect((HOST_ADNROID, PORT)) if type == TYPE_IOS: soc.connect((HOST_IOS, PORT)) - time.sleep(3) + time.sleep(1) print 'autotest run:' soc.send('autotest run\r\n') @@ -65,8 +66,8 @@ def MAC_BUILD(): if not cleanProj(): print '**CLEAN FAILED**' if not buildProj(): - cleanProj() - buildProj() + print '**BUILD FAILED**' + return False if not openProj(): return False time.sleep(sleep_time) @@ -118,8 +119,10 @@ def ANDROID_BUILD(): #----------------autotest-android build and run end----------------# def main(): + print 'will build mac project.' suc_build_mac = MAC_BUILD() - suc_build_android = ANDROID_BUILD() + #print 'will build android project.' + #suc_build_android = ANDROID_BUILD() if suc_build_mac: autotest(TYPE_MAC) if suc_build_android: From bf68f180b437704c4c2a80e3c234647753afa5eb Mon Sep 17 00:00:00 2001 From: zhangbin Date: Mon, 17 Mar 2014 15:25:07 +0800 Subject: [PATCH 7/7] Update the reference of submodule "cocos2d-console". --- tools/cocos2d-console | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/cocos2d-console b/tools/cocos2d-console index e06b610aa7..79fa77ec13 160000 --- a/tools/cocos2d-console +++ b/tools/cocos2d-console @@ -1 +1 @@ -Subproject commit e06b610aa7bb1b5357f0700f1370ea64f9cb4b83 +Subproject commit 79fa77ec132d6037f35110bde66fb882d82eb0de