From b04c38bdb9ef10f9a56ee795a35daaac2a87f036 Mon Sep 17 00:00:00 2001 From: creador Date: Fri, 10 Feb 2017 22:51:36 -0300 Subject: [PATCH] now assets are on the correct subdirectories inside output dir --- README.md | 7 +++++-- package.json | 2 +- ti_recover.js | 14 ++++++++++---- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e31a5cb..45fd244 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ Can have the keys:
This returns true/false on the callback, indicating the given APK was made or not using Titanium. ### extract (onReadyCB). -This does the extraction of assets and js sources into memory (passed to callback onReady(err, data)). +This does the extraction of assets and js sources into memory. ### reconstruct (onReadyCB). `in progress` This attempts to rebuild the source code from memory into a structure that can be opened as a Titanium Project. @@ -46,7 +46,10 @@ Retrieves Titanium information about the current APK using the extracted resourc ## UPDATES -version 1.0.7-9: +version 1.1.0: +- now assets are put on the correct directories. + +version 1.0.9: - updated to latest apk_unpack to use jadx. - now resources and manifest are also copied to outputdir diff --git a/package.json b/package.json index d5345f6..53a92eb 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ti_recover", - "version": "1.0.9", + "version": "1.1.0", "description": "Appcelerator Titanium APK source code recovery tool", "main": "ti_recover.js", "repository": { diff --git a/ti_recover.js b/ti_recover.js index a35582a..be3d991 100644 --- a/ti_recover.js +++ b/ti_recover.js @@ -14,7 +14,8 @@ var _tmp = { package_name : '', memory_source : {}, _tmp_used : false, - _isit_in_dev : false + _isit_in_dev : false, + _restructured : false }; var _config = { @@ -160,8 +161,10 @@ var writeToDisk = function() { // delete existing file first fs.truncateSync(_tmp_file,0); } - fs.writeFileSync(_tmp_file, _prettyCode(_tmp.memory_source[_i].content)); - console.log(colors.yellow('writeToDisk-> file '+_i+' written.')); + var _pti = _prettyCode(_tmp.memory_source[_i].content); + var _byt = (_pti.length>1000)?Math.round(_pti.length/1024)+' KB':_pti.length+ ' Bytes'; + fs.writeFileSync(_tmp_file, _pti); + console.log(colors.yellow('writeToDisk-> file '+_i+' written ('+_byt+').')); } } else { console.log('writeToDisk-> You must first call extract method.'.red); @@ -175,7 +178,10 @@ var copyAssets = function() { // copy AndroidManifest.xml to output dir _file.copySync(_config.apk_dir+'AndroidManifest.xml', _config.out_dir+'AndroidManifest.xml'); // copy assets - _copy_dir.sync(_config.apk_dir+'assets'+path.sep, _config.out_dir+'assets'+path.sep); + if (_tmp._restructured) { + } else { + _copy_dir.sync(_config.apk_dir+'assets'+path.sep+'Resources'+path.sep, _config.out_dir); // +'assets'+path.sep + } }; var clean = function() {