Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into develop_3_fix

This commit is contained in:
samuele3hu 2014-03-18 10:40:12 +08:00
commit 402b6f0f28
6 changed files with 24 additions and 20 deletions

View File

@ -1 +1 @@
874372f8d3779318a2f70b74984575e632ff0dc8 936b6bad063ed7529710ca0edf9290b051097b23

View File

@ -252,6 +252,8 @@ Console::Console()
, _running(false) , _running(false)
, _endThread(false) , _endThread(false)
, _sendDebugStrings(false) , _sendDebugStrings(false)
,_fileUploading(false)
,_uploadFileSize(0)
{ {
// VS2012 doesn't support initializer list, so we create a new array and assign its elements to '_command'. // VS2012 doesn't support initializer list, so we create a new array and assign its elements to '_command'.
Command commands[] = { Command commands[] = {
@ -290,6 +292,7 @@ Console::Console()
{ {
_commands.insert ( std::pair<std::string,Command>(commands[i].name,commands[i]) ); _commands.insert ( std::pair<std::string,Command>(commands[i].name,commands[i]) );
} }
_writablePath = FileUtils::getInstance()->getWritablePath();
} }
Console::~Console() Console::~Console()
@ -759,9 +762,9 @@ void Console::commandUpload(int fd, const std::string& args)
auto argv = split(args,' '); auto argv = split(args,' ');
if(argv.size() == 2) if(argv.size() == 2)
{ {
_upload_file_name = argv[0]; _uploadFileName = argv[0];
_upload_file_size = std::atoi(argv[1].c_str()); _uploadFileSize = std::atoi(argv[1].c_str());
_file_uploading = true; _fileUploading = true;
} }
else else
{ {
@ -853,10 +856,7 @@ ssize_t Console::readfile(int fd, std::string& file_name, int file_size)
ssize_t n, rc; ssize_t n, rc;
char c; char c;
auto sharedFileUtils = FileUtils::getInstance(); std::string fileName = _writablePath+file_name;
std::string writablePath = sharedFileUtils->getWritablePath();
std::string fileName = writablePath+file_name;
FILE* fp = fopen(fileName.c_str(), "wb"); FILE* fp = fopen(fileName.c_str(), "wb");
if(!fp) if(!fp)
@ -970,7 +970,7 @@ void Console::loop()
for(const auto &fd: _fds) { for(const auto &fd: _fds) {
if(FD_ISSET(fd,&copy_set)) if(FD_ISSET(fd,&copy_set))
{ {
if(!_file_uploading) if(!_fileUploading)
{ {
if( ! parseCommand(fd) ) if( ! parseCommand(fd) )
{ {
@ -979,8 +979,8 @@ void Console::loop()
} }
else else
{ {
readfile(fd, _upload_file_name, _upload_file_size); readfile(fd, _uploadFileName, _uploadFileSize);
_file_uploading = false; _fileUploading = false;
} }
if(--nready <= 0) if(--nready <= 0)

View File

@ -128,9 +128,10 @@ protected:
bool _running; bool _running;
bool _endThread; bool _endThread;
bool _file_uploading; bool _fileUploading;
ssize_t _upload_file_size; ssize_t _uploadFileSize;
std::string _upload_file_name; std::string _uploadFileName;
std::string _writablePath;
std::map<std::string, Command> _commands; std::map<std::string, Command> _commands;

View File

@ -363,7 +363,7 @@ bool CreateDir(const char *sPathName)
bool FileServer::recv_file(int fd) bool FileServer::recv_file(int fd)
{ {
char buffer[1024]={0}; char buffer[1024]={0};
char namelen[4]={0}; char namelen[5]={0};
if (recv(fd, namelen, 4,0)<=0) { if (recv(fd, namelen, 4,0)<=0) {
return false; return false;
} }

@ -1 +1 @@
Subproject commit e06b610aa7bb1b5357f0700f1370ea64f9cb4b83 Subproject commit 79fa77ec132d6037f35110bde66fb882d82eb0de

View File

@ -1,3 +1,4 @@
#!/usr/bin/python
import os import os
import sys import sys
import subprocess import subprocess
@ -25,7 +26,7 @@ def autotest(type):
soc.connect((HOST_ADNROID, PORT)) soc.connect((HOST_ADNROID, PORT))
if type == TYPE_IOS: if type == TYPE_IOS:
soc.connect((HOST_IOS, PORT)) soc.connect((HOST_IOS, PORT))
time.sleep(3) time.sleep(1)
print 'autotest run:' print 'autotest run:'
soc.send('autotest run\r\n') soc.send('autotest run\r\n')
@ -65,8 +66,8 @@ def MAC_BUILD():
if not cleanProj(): if not cleanProj():
print '**CLEAN FAILED**' print '**CLEAN FAILED**'
if not buildProj(): if not buildProj():
cleanProj() print '**BUILD FAILED**'
buildProj() return False
if not openProj(): if not openProj():
return False return False
time.sleep(sleep_time) time.sleep(sleep_time)
@ -118,8 +119,10 @@ def ANDROID_BUILD():
#----------------autotest-android build and run end----------------# #----------------autotest-android build and run end----------------#
def main(): def main():
print 'will build mac project.'
suc_build_mac = MAC_BUILD() suc_build_mac = MAC_BUILD()
suc_build_android = ANDROID_BUILD() #print 'will build android project.'
#suc_build_android = ANDROID_BUILD()
if suc_build_mac: if suc_build_mac:
autotest(TYPE_MAC) autotest(TYPE_MAC)
if suc_build_android: if suc_build_android: