Loading res/xml/command_list.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,7 @@ <command commandId="folderusage" commandPath="/system/bin/ls" commandArgs="-alR %1$s" /> <command commandId="folderusage" commandPath="/system/bin/ls" commandArgs="-alR %1$s" /> <command commandId="groups" commandPath="/system/xbin/groups" commandArgs="" /> <command commandId="groups" commandPath="/system/xbin/groups" commandArgs="" /> <command commandId="id" commandPath="/system/bin/id" commandArgs="-Gn" /> <command commandId="id" commandPath="/system/bin/id" commandArgs="-Gn" /> <command commandId="link" commandPath="/system/bin/ln" commandArgs="-s %1$s %2$s" /> <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="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="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="mount" commandPath="/system/bin/mount" commandArgs="-o %1$s,remount -t auto %2$s %3$s" /> Loading src/com/cyanogenmod/explorer/commands/ExecutableCreator.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -200,6 +200,17 @@ public interface ExecutableCreator { */ */ IdentityExecutable createIdentityExecutable() throws CommandNotFoundException; IdentityExecutable createIdentityExecutable() throws CommandNotFoundException; /** * Method that creates a symlink of an other file system object. * * @param src The absolute path to the source fso * @param link The absolute path to the link fso * @return LinkExecutable A {@link LinkExecutable} executable implementation reference * @throws CommandNotFoundException If the executable can't be created */ LinkExecutable createLinkExecutable( String src, String link) throws CommandNotFoundException; /** /** * Method that creates an executable for list files of a directory. * Method that creates an executable for list files of a directory. * * Loading src/com/cyanogenmod/explorer/commands/LinkExecutable.java 0 → 100644 +29 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2012 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cyanogenmod.explorer.commands; /** * An interface that represents an executable for create symlinks to other file system objects. */ public interface LinkExecutable extends WritableExecutable { /** * {@inheritDoc} */ @Override Boolean getResult(); } src/com/cyanogenmod/explorer/commands/shell/LinkCommand.java 0 → 100644 +88 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2012 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cyanogenmod.explorer.commands.shell; import com.cyanogenmod.explorer.commands.LinkExecutable; import com.cyanogenmod.explorer.console.CommandNotFoundException; import com.cyanogenmod.explorer.console.ExecutionException; import com.cyanogenmod.explorer.console.InsufficientPermissionsException; import com.cyanogenmod.explorer.model.MountPoint; import com.cyanogenmod.explorer.util.MountPointHelper; import java.text.ParseException; /** * A class for create a symlink of an other file system object. * * {@link "http://unixhelp.ed.ac.uk/CGI/man-cgi?ln"} */ public class LinkCommand extends SyncResultProgram implements LinkExecutable { private static final String ID = "link"; //$NON-NLS-1$ private Boolean mRet; private final String mLink; /** * Constructor of <code>LinkCommand</code>. * * @param src The path of the source file * @param link The path of the link file * @throws InvalidCommandDefinitionException If the command has an invalid definition */ public LinkCommand(String src, String link) throws InvalidCommandDefinitionException { super(ID, src, link); this.mLink = link; } /** * {@inheritDoc} */ @Override public void parse(String in, String err) throws ParseException { //Release the return object this.mRet = Boolean.TRUE; } /** * {@inheritDoc} */ @Override public Boolean getResult() { return this.mRet; } /** * {@inheritDoc} */ @Override public void checkExitCode(int exitCode) throws InsufficientPermissionsException, CommandNotFoundException, ExecutionException { // Not raise insufficient permissions if the link is in if (exitCode != 0) { throw new ExecutionException("exitcode != 0"); //$NON-NLS-1$ } } /** * {@inheritDoc} */ @Override public MountPoint getWritableMountPoint() { return MountPointHelper.getMountPointFromDirectory(this.mLink); } } src/com/cyanogenmod/explorer/commands/shell/ShellExecutableCreator.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.cyanogenmod.explorer.commands.FindExecutable; import com.cyanogenmod.explorer.commands.FolderUsageExecutable; import com.cyanogenmod.explorer.commands.FolderUsageExecutable; import com.cyanogenmod.explorer.commands.GroupsExecutable; import com.cyanogenmod.explorer.commands.GroupsExecutable; import com.cyanogenmod.explorer.commands.IdentityExecutable; import com.cyanogenmod.explorer.commands.IdentityExecutable; import com.cyanogenmod.explorer.commands.LinkExecutable; import com.cyanogenmod.explorer.commands.ListExecutable; import com.cyanogenmod.explorer.commands.ListExecutable; import com.cyanogenmod.explorer.commands.MountExecutable; import com.cyanogenmod.explorer.commands.MountExecutable; import com.cyanogenmod.explorer.commands.MountPointInfoExecutable; import com.cyanogenmod.explorer.commands.MountPointInfoExecutable; Loading Loading @@ -271,6 +272,20 @@ public class ShellExecutableCreator implements ExecutableCreator { } } } } /** * {@inheritDoc} */ @Override public LinkExecutable createLinkExecutable(String src, String link) throws CommandNotFoundException { try { return new LinkCommand(src, link); } catch (InvalidCommandDefinitionException icdEx) { throw new CommandNotFoundException("LinkCommand", icdEx); //$NON-NLS-1$ } } /** /** * {@inheritDoc} * {@inheritDoc} */ */ Loading Loading
res/xml/command_list.xml +1 −0 Original line number Original line Diff line number Diff line Loading @@ -49,6 +49,7 @@ <command commandId="folderusage" commandPath="/system/bin/ls" commandArgs="-alR %1$s" /> <command commandId="folderusage" commandPath="/system/bin/ls" commandArgs="-alR %1$s" /> <command commandId="groups" commandPath="/system/xbin/groups" commandArgs="" /> <command commandId="groups" commandPath="/system/xbin/groups" commandArgs="" /> <command commandId="id" commandPath="/system/bin/id" commandArgs="-Gn" /> <command commandId="id" commandPath="/system/bin/id" commandArgs="-Gn" /> <command commandId="link" commandPath="/system/bin/ln" commandArgs="-s %1$s %2$s" /> <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="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="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="mount" commandPath="/system/bin/mount" commandArgs="-o %1$s,remount -t auto %2$s %3$s" /> Loading
src/com/cyanogenmod/explorer/commands/ExecutableCreator.java +11 −0 Original line number Original line Diff line number Diff line Loading @@ -200,6 +200,17 @@ public interface ExecutableCreator { */ */ IdentityExecutable createIdentityExecutable() throws CommandNotFoundException; IdentityExecutable createIdentityExecutable() throws CommandNotFoundException; /** * Method that creates a symlink of an other file system object. * * @param src The absolute path to the source fso * @param link The absolute path to the link fso * @return LinkExecutable A {@link LinkExecutable} executable implementation reference * @throws CommandNotFoundException If the executable can't be created */ LinkExecutable createLinkExecutable( String src, String link) throws CommandNotFoundException; /** /** * Method that creates an executable for list files of a directory. * Method that creates an executable for list files of a directory. * * Loading
src/com/cyanogenmod/explorer/commands/LinkExecutable.java 0 → 100644 +29 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2012 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cyanogenmod.explorer.commands; /** * An interface that represents an executable for create symlinks to other file system objects. */ public interface LinkExecutable extends WritableExecutable { /** * {@inheritDoc} */ @Override Boolean getResult(); }
src/com/cyanogenmod/explorer/commands/shell/LinkCommand.java 0 → 100644 +88 −0 Original line number Original line Diff line number Diff line /* * Copyright (C) 2012 The CyanogenMod Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.cyanogenmod.explorer.commands.shell; import com.cyanogenmod.explorer.commands.LinkExecutable; import com.cyanogenmod.explorer.console.CommandNotFoundException; import com.cyanogenmod.explorer.console.ExecutionException; import com.cyanogenmod.explorer.console.InsufficientPermissionsException; import com.cyanogenmod.explorer.model.MountPoint; import com.cyanogenmod.explorer.util.MountPointHelper; import java.text.ParseException; /** * A class for create a symlink of an other file system object. * * {@link "http://unixhelp.ed.ac.uk/CGI/man-cgi?ln"} */ public class LinkCommand extends SyncResultProgram implements LinkExecutable { private static final String ID = "link"; //$NON-NLS-1$ private Boolean mRet; private final String mLink; /** * Constructor of <code>LinkCommand</code>. * * @param src The path of the source file * @param link The path of the link file * @throws InvalidCommandDefinitionException If the command has an invalid definition */ public LinkCommand(String src, String link) throws InvalidCommandDefinitionException { super(ID, src, link); this.mLink = link; } /** * {@inheritDoc} */ @Override public void parse(String in, String err) throws ParseException { //Release the return object this.mRet = Boolean.TRUE; } /** * {@inheritDoc} */ @Override public Boolean getResult() { return this.mRet; } /** * {@inheritDoc} */ @Override public void checkExitCode(int exitCode) throws InsufficientPermissionsException, CommandNotFoundException, ExecutionException { // Not raise insufficient permissions if the link is in if (exitCode != 0) { throw new ExecutionException("exitcode != 0"); //$NON-NLS-1$ } } /** * {@inheritDoc} */ @Override public MountPoint getWritableMountPoint() { return MountPointHelper.getMountPointFromDirectory(this.mLink); } }
src/com/cyanogenmod/explorer/commands/shell/ShellExecutableCreator.java +15 −0 Original line number Original line Diff line number Diff line Loading @@ -33,6 +33,7 @@ import com.cyanogenmod.explorer.commands.FindExecutable; import com.cyanogenmod.explorer.commands.FolderUsageExecutable; import com.cyanogenmod.explorer.commands.FolderUsageExecutable; import com.cyanogenmod.explorer.commands.GroupsExecutable; import com.cyanogenmod.explorer.commands.GroupsExecutable; import com.cyanogenmod.explorer.commands.IdentityExecutable; import com.cyanogenmod.explorer.commands.IdentityExecutable; import com.cyanogenmod.explorer.commands.LinkExecutable; import com.cyanogenmod.explorer.commands.ListExecutable; import com.cyanogenmod.explorer.commands.ListExecutable; import com.cyanogenmod.explorer.commands.MountExecutable; import com.cyanogenmod.explorer.commands.MountExecutable; import com.cyanogenmod.explorer.commands.MountPointInfoExecutable; import com.cyanogenmod.explorer.commands.MountPointInfoExecutable; Loading Loading @@ -271,6 +272,20 @@ public class ShellExecutableCreator implements ExecutableCreator { } } } } /** * {@inheritDoc} */ @Override public LinkExecutable createLinkExecutable(String src, String link) throws CommandNotFoundException { try { return new LinkCommand(src, link); } catch (InvalidCommandDefinitionException icdEx) { throw new CommandNotFoundException("LinkCommand", icdEx); //$NON-NLS-1$ } } /** /** * {@inheritDoc} * {@inheritDoc} */ */ Loading