Loading res/xml/command_list.xml +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ <command commandId="folderusage" commandPath="/system/bin/ls" commandArgs="-alR %1$s" /> <command commandId="groups" commandPath="/system/xbin/groups" commandArgs="" /> <command commandId="id" commandPath="/system/bin/id" commandArgs="-Gn" /> <command commandId="ls" commandPath="cd" commandArgs="%1$s && /system/bin/ls -al %1$s | /system/xbin/grep -v -e '->' && echo '>SIMLINKS>' && /system/bin/ls -al %1$s | { /system/xbin/grep -e '->' || true; } && echo '>SIMLINKS_DATA>' && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/awk '{print substr($0, index($0,$2))}' | /system/xbin/xargs -r -0 /system/xbin/readlink -f && /system/bin/ls -F %1$s | /system/xbin/grep -e '^l' | /system/xbin/awk '{print substr($0, index($0,$2))}' | /system/xbin/xargs -r -0 /system/xbin/readlink -f | { /system/xbin/xargs -r -0 /system/bin/ls -ald || echo; }" /> <command commandId="ls" commandPath="cd" commandArgs="%1$s && /system/bin/ls -al %1$s | /system/xbin/grep -v -e '^l' && echo '>SIMLINKS>' && /system/bin/ls -al %1$s | { /system/xbin/grep -e '^l' || true; } && echo '>SIMLINKS_DATA>' && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f && /system/bin/ls -F %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f | awk '{print "\\""$0"\\""}' | { /system/xbin/xargs -r /system/bin/ls -ald || echo; }" /> <command commandId="mkdir" commandPath="/system/bin/mkdir" commandArgs="%1$s" /> <command commandId="mount" commandPath="/system/bin/mount" commandArgs="-o %1$s,remount -t auto %2$s %3$s" /> <command commandId="mountpointinfo" commandPath="/system/bin/cat" commandArgs="/proc/mounts" /> Loading src/com/cyanogenmod/explorer/commands/shell/ListCommand.java +53 −9 Original line number Diff line number Diff line Loading @@ -139,9 +139,15 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { //Get the absolute path try { if (followSymlinks) { this.mParentDir = FileHelper.removeTrailingSlash( new File(src).getCanonicalFile().getParent()); } else { this.mParentDir = FileHelper.removeTrailingSlash( new File(src).getAbsoluteFile().getParent()); } } catch (Exception e) { // Try to resolve from a console Loading Loading @@ -216,12 +222,26 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { szLine = br.readLine(); line++; //The next information is known: symlinksCount * 2 //The next information is known: symlinksCount * 3 String[] name = new String[symlinksCount]; String[] absPath = new String[symlinksCount]; String[] refPath = new String[symlinksCount]; for (int i = 0; i < symlinksCount; i++) { if (szLine == null || szLine.trim().length() == 0) { name[i] = null; szLine = br.readLine(); line++; continue; } name[i] = szLine; szLine = br.readLine(); line++; } for (int i = 0; i < symlinksCount; i++) { if (szLine == null || szLine.trim().length() == 0) { absPath[i] = null; szLine = br.readLine(); line++; continue; } absPath[i] = szLine; Loading @@ -231,6 +251,8 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { for (int i = 0; i < symlinksCount; i++) { if (szLine == null || szLine.trim().length() == 0) { refPath[i] = null; szLine = br.readLine(); line++; continue; } refPath[i] = szLine; Loading @@ -238,6 +260,27 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { line++; } //Fill the parent if is null for (int i = 0; i < symlinksCount; i++) { Symlink symLink = ((Symlink)this.mFiles.get( this.mFiles.size() - symlinksCount + i)); if (symLink.getParent() == null) { symLink.setParent(FileHelper.ROOT_DIRECTORY); } } // Symlink can cause incoherences in the name because "->" string // Now, we have the real name of the symlink for (int i = 0; i < symlinksCount; i++) { if (name[i] != null) { Symlink symLink = ((Symlink)this.mFiles.get( this.mFiles.size() - symlinksCount + i)); symLink.setName(name[i]); } } //Fill the data for (int i = 0; i < symlinksCount; i++) { try { Loading @@ -245,12 +288,13 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { Symlink symLink = ((Symlink)this.mFiles.get( this.mFiles.size() - symlinksCount + i)); String name = new File(absPath[i]).getName(); symLink.setName(name); String parent = new File(absPath[i]).getParent(); String parentLink = new File(absPath[i]).getParent(); if (parentLink == null) { parentLink = FileHelper.ROOT_DIRECTORY; } String info = refPath[i]; FileSystemObject fsoRef = ParseHelper.toFileSystemObject(parent, info); ParseHelper.toFileSystemObject(parentLink, info); symLink.setLinkRef(fsoRef); } } catch (Throwable ex) { Loading @@ -264,10 +308,10 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { //Add the symlink try { this.mFiles.add(ParseHelper.toFileSystemObject(this.mParentDir, szLine)); symlinksCount++; } catch (ParseException pEx) { throw new ParseException(pEx.getMessage(), line); } symlinksCount++; } line++; Loading Loading
res/xml/command_list.xml +1 −1 Original line number Diff line number Diff line Loading @@ -49,7 +49,7 @@ <command commandId="folderusage" commandPath="/system/bin/ls" commandArgs="-alR %1$s" /> <command commandId="groups" commandPath="/system/xbin/groups" commandArgs="" /> <command commandId="id" commandPath="/system/bin/id" commandArgs="-Gn" /> <command commandId="ls" commandPath="cd" commandArgs="%1$s && /system/bin/ls -al %1$s | /system/xbin/grep -v -e '->' && echo '>SIMLINKS>' && /system/bin/ls -al %1$s | { /system/xbin/grep -e '->' || true; } && echo '>SIMLINKS_DATA>' && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/awk '{print substr($0, index($0,$2))}' | /system/xbin/xargs -r -0 /system/xbin/readlink -f && /system/bin/ls -F %1$s | /system/xbin/grep -e '^l' | /system/xbin/awk '{print substr($0, index($0,$2))}' | /system/xbin/xargs -r -0 /system/xbin/readlink -f | { /system/xbin/xargs -r -0 /system/bin/ls -ald || echo; }" /> <command commandId="ls" commandPath="cd" commandArgs="%1$s && /system/bin/ls -al %1$s | /system/xbin/grep -v -e '^l' && echo '>SIMLINKS>' && /system/bin/ls -al %1$s | { /system/xbin/grep -e '^l' || true; } && echo '>SIMLINKS_DATA>' && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- && /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f && /system/bin/ls -F %1$s | /system/xbin/grep -e '^l' | /system/xbin/cut -d ' ' -f2- | awk '{print "\\""$0"\\""}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f | awk '{print "\\""$0"\\""}' | { /system/xbin/xargs -r /system/bin/ls -ald || echo; }" /> <command commandId="mkdir" commandPath="/system/bin/mkdir" commandArgs="%1$s" /> <command commandId="mount" commandPath="/system/bin/mount" commandArgs="-o %1$s,remount -t auto %2$s %3$s" /> <command commandId="mountpointinfo" commandPath="/system/bin/cat" commandArgs="/proc/mounts" /> Loading
src/com/cyanogenmod/explorer/commands/shell/ListCommand.java +53 −9 Original line number Diff line number Diff line Loading @@ -139,9 +139,15 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { //Get the absolute path try { if (followSymlinks) { this.mParentDir = FileHelper.removeTrailingSlash( new File(src).getCanonicalFile().getParent()); } else { this.mParentDir = FileHelper.removeTrailingSlash( new File(src).getAbsoluteFile().getParent()); } } catch (Exception e) { // Try to resolve from a console Loading Loading @@ -216,12 +222,26 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { szLine = br.readLine(); line++; //The next information is known: symlinksCount * 2 //The next information is known: symlinksCount * 3 String[] name = new String[symlinksCount]; String[] absPath = new String[symlinksCount]; String[] refPath = new String[symlinksCount]; for (int i = 0; i < symlinksCount; i++) { if (szLine == null || szLine.trim().length() == 0) { name[i] = null; szLine = br.readLine(); line++; continue; } name[i] = szLine; szLine = br.readLine(); line++; } for (int i = 0; i < symlinksCount; i++) { if (szLine == null || szLine.trim().length() == 0) { absPath[i] = null; szLine = br.readLine(); line++; continue; } absPath[i] = szLine; Loading @@ -231,6 +251,8 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { for (int i = 0; i < symlinksCount; i++) { if (szLine == null || szLine.trim().length() == 0) { refPath[i] = null; szLine = br.readLine(); line++; continue; } refPath[i] = szLine; Loading @@ -238,6 +260,27 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { line++; } //Fill the parent if is null for (int i = 0; i < symlinksCount; i++) { Symlink symLink = ((Symlink)this.mFiles.get( this.mFiles.size() - symlinksCount + i)); if (symLink.getParent() == null) { symLink.setParent(FileHelper.ROOT_DIRECTORY); } } // Symlink can cause incoherences in the name because "->" string // Now, we have the real name of the symlink for (int i = 0; i < symlinksCount; i++) { if (name[i] != null) { Symlink symLink = ((Symlink)this.mFiles.get( this.mFiles.size() - symlinksCount + i)); symLink.setName(name[i]); } } //Fill the data for (int i = 0; i < symlinksCount; i++) { try { Loading @@ -245,12 +288,13 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { Symlink symLink = ((Symlink)this.mFiles.get( this.mFiles.size() - symlinksCount + i)); String name = new File(absPath[i]).getName(); symLink.setName(name); String parent = new File(absPath[i]).getParent(); String parentLink = new File(absPath[i]).getParent(); if (parentLink == null) { parentLink = FileHelper.ROOT_DIRECTORY; } String info = refPath[i]; FileSystemObject fsoRef = ParseHelper.toFileSystemObject(parent, info); ParseHelper.toFileSystemObject(parentLink, info); symLink.setLinkRef(fsoRef); } } catch (Throwable ex) { Loading @@ -264,10 +308,10 @@ public class ListCommand extends SyncResultProgram implements ListExecutable { //Add the symlink try { this.mFiles.add(ParseHelper.toFileSystemObject(this.mParentDir, szLine)); symlinksCount++; } catch (ParseException pEx) { throw new ParseException(pEx.getMessage(), line); } symlinksCount++; } line++; Loading