Skip to content

Commit

Permalink
1.0.1. Fixed patching.
Browse files Browse the repository at this point in the history
  • Loading branch information
NatWeiss committed Feb 2, 2016
1 parent 35c5fe1 commit 944b7ef
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
Version 1.0.1 - February 1, 2016

Fixed cocos2d-x patching.

Version 1.0.0 - January 26, 2016

Linux support.
Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rapidgame",
"version": "1.0.0",
"version": "1.0.1",
"description": "A cross-platform commandline tool that prebuilds cocos2d-x libraries for Windows, Mac, Linux, Android and iOS. Also a game templating system.",
"author": {
"name": "Nathanael Weiss",
Expand Down Expand Up @@ -55,8 +55,7 @@
"CHANGELOG.txt",
"LICENSE",
"README.md",
"src/cocos2d.patch",
"src/proj.android",
"src/proj.ios_mac"
"src/ccx.patch",
"src/proj.android"
]
}
24 changes: 16 additions & 8 deletions rapidgame.js
Original file line number Diff line number Diff line change
Expand Up @@ -537,12 +537,12 @@ var downloadCocos = function(callback) {

var globPath = path.join(dir, cocos2dDirGlob),
files = glob.sync(globPath),
patchSize,
cmd;
patchSize, src, command;
if (!files || files.length !== 1) {
logErr("Couldn't glob " + globPath);
return;
}
files[0] = path.normalize(files[0]);

// Rename extract dir
try {
Expand All @@ -551,8 +551,14 @@ var downloadCocos = function(callback) {

// Save downloaded version
fs.writeFileSync(downloaded, cocos2dxUrl);
} catch(e) {
logErr("Couldn't move " + files[0] + " to " + dest);
logErr(e);
}

src = path.join(dir, "ccx.patch");
// apply patch
src = path.join(__dirname, "src", "ccx.patch");
try {
patchSize = fs.statSync(src).size;
if (patchSize > 8) {
// Apply patch
Expand All @@ -561,20 +567,22 @@ var downloadCocos = function(callback) {

// for some reason git apply sometimes does not work and produces no output...
// (use the patch command instead)
cmd = "patch -p1 < ";
command = "patch -p1 < ";
if (process.platform === "win32") {
cmd = "git apply --whitespace=nowarn ";
command = "git apply --whitespace=nowarn ";
}
cmd += '"' + src + '"';
exec(cmd, {cwd: dest, env: process.env}, function(err){
command += '"' + src + '"';
exec(command, {cwd: dest, env: process.env}, function(err){
callback();
});
} else {
logBuild("Skipping patch file (" + patchSize + " bytes): " + src, true);
callback();
}
} catch(e) {
logErr("Couldn't move " + files[0] + " to " + dest)
logErr("Couldn't apply patch: " + src);
logErr(e);
callback();
}
});
};
Expand Down

0 comments on commit 944b7ef

Please sign in to comment.