diff options
author | jruesga <jorge@ruesga.com> | 2012-10-19 01:04:55 +0200 |
---|---|---|
committer | jruesga <jorge@ruesga.com> | 2012-10-19 01:04:55 +0200 |
commit | f3dd56e14219da4edaea88f1d3942412a854d816 (patch) | |
tree | 6b5252b74329b955adce9985c38087493503ac28 | |
parent | 44100f9a6bbd5fa9eca96c6970115b5ac53c7212 (diff) | |
download | android_packages_apps_CMFileManager-f3dd56e14219da4edaea88f1d3942412a854d816.tar.gz android_packages_apps_CMFileManager-f3dd56e14219da4edaea88f1d3942412a854d816.tar.bz2 android_packages_apps_CMFileManager-f3dd56e14219da4edaea88f1d3942412a854d816.zip |
Fix uncompress command bugs
-rw-r--r-- | res/xml/command_list.xml | 6 | ||||
-rw-r--r-- | src/com/cyanogenmod/explorer/commands/shell/UncompressCommand.java | 21 |
2 files changed, 13 insertions, 14 deletions
diff --git a/res/xml/command_list.xml b/res/xml/command_list.xml index 0309d9e4..b2959c30 100644 --- a/res/xml/command_list.xml +++ b/res/xml/command_list.xml @@ -64,7 +64,7 @@ <command commandId="chown" commandPath="/system/bin/chown" commandArgs="%1$s.%2$s %3$s" /> <command commandId="cp" commandPath="/system/xbin/cp" commandArgs="-af %1$s %2$s" /> <command commandId="link" commandPath="/system/bin/ln" commandArgs="-s %1$s %2$s" /> - <command commandId="mkdir" commandPath="/system/bin/mkdir" commandArgs="%1$s" /> + <command commandId="mkdir" commandPath="/system/bin/mkdir" commandArgs="-p %1$s" /> <command commandId="mv" commandPath="/system/bin/mv" commandArgs="%1$s %2$s" /> <command commandId="rm" commandPath="/system/bin/rm" commandArgs="%1$s" /> <command commandId="rmdir" commandPath="/system/bin/rm" commandArgs="-R %1$s" /> @@ -93,12 +93,12 @@ <command commandId="terminate" commandPath="/system/bin/kill" commandArgs="%1$s" /> <!-- Compress --> - <command commandId="compress" commandPath="/system/xbin/tar" commandArgs="%1$scvf %2$s [@]" /> + <command commandId="compress" commandPath="/system/xbin/tar" commandArgs="-%1$scvf %2$s [@]" /> <command commandId="gzip" commandPath="/system/bin/gzip" commandArgs="%1$s" /> <command commandId="bzip" commandPath="/system/xbin/bzip2" commandArgs="-f %1$s" /> <!-- Uncompress --> - <command commandId="untar" commandPath="/system/bin/mkdir" commandArgs="-p %2$s && /system/xbin/tar -C %2$s %1$sxvf %3$s" /> + <command commandId="untar" commandPath="/system/bin/mkdir" commandArgs="-p %2$s && /system/xbin/tar -C %2$s -%1$sxvf %3$s" /> <command commandId="unzip" commandPath="/system/bin/mkdir" commandArgs="-p %1$s && /system/xbin/unzip -o %2$s -d %1$s" /> <command commandId="gunzip" commandPath="/system/xbin/gunzip" commandArgs="-f %1$s" /> <command commandId="bunzip" commandPath="/system/xbin/bunzip2" commandArgs="-f %1$s" /> diff --git a/src/com/cyanogenmod/explorer/commands/shell/UncompressCommand.java b/src/com/cyanogenmod/explorer/commands/shell/UncompressCommand.java index 7a51f525..c7c4c2b0 100644 --- a/src/com/cyanogenmod/explorer/commands/shell/UncompressCommand.java +++ b/src/com/cyanogenmod/explorer/commands/shell/UncompressCommand.java @@ -52,19 +52,19 @@ public class UncompressCommand extends AsyncResultProgram implements UncompressE /** * Uncompress using Gzip algorithm */ - AC_GUNZIP(GUNZIP_ID, "z", "tar.gz", true), //$NON-NLS-1$ //$NON-NLS-2$ + AC_GUNZIP(UNTAR_ID, "z", "tar.gz", true), //$NON-NLS-1$ //$NON-NLS-2$ /** * Uncompress using Gzip algorithm */ - AC_GUNZIP2(GUNZIP_ID, "z", "tgz", true), //$NON-NLS-1$ //$NON-NLS-2$ + AC_GUNZIP2(UNTAR_ID, "z", "tgz", true), //$NON-NLS-1$ //$NON-NLS-2$ /** * Uncompress using Bzip algorithm */ - AC_BUNZIP(BUNZIP_ID, "j", "tar.bz2", true), //$NON-NLS-1$ //$NON-NLS-2$ + AC_BUNZIP(UNTAR_ID, "j", "tar.bz2", true), //$NON-NLS-1$ //$NON-NLS-2$ /** * Uncompress using Lzma algorithm */ - AC_UNLZMA(UNLZMA_ID, "a", "tar.lzma", true), //$NON-NLS-1$ //$NON-NLS-2$ + AC_UNLZMA(UNTAR_ID, "a", "tar.lzma", true), //$NON-NLS-1$ //$NON-NLS-2$ /** * Uncompress using Gzip algorithm */ @@ -80,11 +80,11 @@ public class UncompressCommand extends AsyncResultProgram implements UncompressE /** * Uncompress using Unix compress algorithm */ - C_UNCOMPRESS(UNCOMPRESS_ID, "", ".Z", false), //$NON-NLS-1$ //$NON-NLS-2$ + C_UNCOMPRESS(UNCOMPRESS_ID, "", "Z", false), //$NON-NLS-1$ //$NON-NLS-2$ /** * Uncompress using Unix compress algorithm */ - C_UNXZ(UNXZ_ID, "", ".xz", false); //$NON-NLS-1$ //$NON-NLS-2$ + C_UNXZ(UNXZ_ID, "", "xz", false); //$NON-NLS-1$ //$NON-NLS-2$ String mId; String mFlag; @@ -282,8 +282,7 @@ public class UncompressCommand extends AsyncResultProgram implements UncompressE * @return String[] The arguments */ private static String[] resolveArguments(String src) { - String name = FileHelper.getName(src); - File dst = new File(new File(src).getParent(), name); + String dst = resolveOutputFile(src); UncompressionMode mode = getMode(src); if (mode != null) { switch (mode) { @@ -292,10 +291,10 @@ public class UncompressCommand extends AsyncResultProgram implements UncompressE case AC_GUNZIP2: case AC_BUNZIP: case AC_UNLZMA: - return new String[]{mode.mFlag, dst.getAbsolutePath(), src}; + return new String[]{mode.mFlag, dst, src}; case A_UNZIP: - return new String[]{dst.getAbsolutePath(), src}; + return new String[]{dst, src}; case C_GUNZIP: case C_BUNZIP: @@ -317,7 +316,7 @@ public class UncompressCommand extends AsyncResultProgram implements UncompressE * @return String The output path of the uncompressed file */ private static String resolveOutputFile(String src) { - String name = FileHelper.getName(src); + String name = new File(FileHelper.getName(src)).getName(); File dst = new File(new File(src).getParent(), name); return dst.getAbsolutePath(); } |