Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d94a0a07 authored by jruesga's avatar jruesga
Browse files

Better symlinks handle

Resolve symlinks with -> symbols in any of the names (link or real).
parent 4e363cc8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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 &amp;&amp; /system/bin/ls -al %1$s | /system/xbin/grep -v -e '->' &amp;&amp; echo '>SIMLINKS>' &amp;&amp; /system/bin/ls -al %1$s | { /system/xbin/grep -e '->' || true; } &amp;&amp; echo '>SIMLINKS_DATA>' &amp;&amp; /system/bin/ls -aF %1$s | /system/xbin/grep -e '^l' | /system/xbin/awk '{print $2}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f &amp;&amp; /system/bin/ls -F %1$s | /system/xbin/grep -e '^l' | /system/xbin/awk '{print $2}' | /system/xbin/xargs -r -n1 /system/xbin/readlink -f | { /system/xbin/xargs -r -n1 /system/bin/ls -ald || true; }" />
  <command commandId="ls" commandPath="cd" commandArgs="%1$s &amp;&amp; /system/bin/ls -al %1$s | /system/xbin/grep -v -e '->' &amp;&amp; echo '>SIMLINKS>' &amp;&amp; /system/bin/ls -al %1$s | { /system/xbin/grep -e '->' || true; } &amp;&amp; echo '>SIMLINKS_DATA>' &amp;&amp; /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 &amp;&amp; /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="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" />
+1 −1
Original line number Diff line number Diff line
@@ -1154,7 +1154,7 @@ public class NavigationActivity extends Activity
        // Prior to show the dialog, refresh the item reference
        FileSystemObject fso = null;
        try {
            fso = CommandHelper.getFileInfo(this, path, null);
            fso = CommandHelper.getFileInfo(this, path, false, null);

        } catch (Exception e) {
            // Notify the user
+1 −1
Original line number Diff line number Diff line
@@ -851,7 +851,7 @@ public class SearchActivity extends Activity
        // Prior to show the dialog, refresh the item reference
        FileSystemObject fso = null;
        try {
            fso = CommandHelper.getFileInfo(this, item.getFullPath(), null);
            fso = CommandHelper.getFileInfo(this, item.getFullPath(), false, null);

        } catch (Exception e) {
            // Notify the user
+13 −2
Original line number Diff line number Diff line
@@ -204,12 +204,23 @@ public interface ExecutableCreator {
     * Method that creates an executable for list files of a directory.
     *
     * @param src The directory where to do the listing
     * @param mode The listing mode
     * @return ListExecutable A {@link ListExecutable} executable implementation reference
     * @throws CommandNotFoundException If the executable can't be created
     * @see LIST_MODE
     */
    ListExecutable createListExecutable(String src, LIST_MODE mode)
    ListExecutable createListExecutable(String src)
            throws CommandNotFoundException;

    /**
     * Method that creates an executable for retrieve information of a file
     *
     * @param src The directory where to do the listing
     * @param followSymlinks If follow the symlink
     * @return ListExecutable A {@link ListExecutable} executable implementation reference
     * @throws CommandNotFoundException If the executable can't be created
     * @see LIST_MODE
     */
    ListExecutable createFileInfoExecutable(String src, boolean followSymlinks)
            throws CommandNotFoundException;

    /**
+6 −0
Original line number Diff line number Diff line
@@ -144,6 +144,12 @@ public class FindCommand extends AsyncResultProgram implements FindExecutable {
                        // Don't return the directory of the search. Only files under this
                        // directory
                        if (this.mDirectory.compareTo(fso.getFullPath()) != 0) {
                            String name = new File(lines.get(0)).getName();
                            // In some situations, xe when the name has a -> the name is
                            // incorrect resolved, but src name should by fine in this case
                            fso.setName(name);
                            // The symlink is not resolved here

                            this.mFiles.add(fso);
                            partialFiles.add(fso);
                        }
Loading