Beispiel #1
0
  /**
   * This will return a String that represent the symlink for a specified file.
   *
   * @param file The path to the file to get the Symlink for. (must have absolute path)
   * @return A String that represent the symlink for a specified file or null if no symlink exists.
   * @throws IOException
   * @throws TimeoutException
   * @throws BrokenBusyboxException
   */
  public String getSymlink(String file) throws FailedExecuteCommand, TimeoutException, IOException {
    Log.d(RootCommands.TAG, "Find symlink for " + file);

    String symlink;

    LsCommand lsCommand = new LsCommand(file);
    shell.execCommand(lsCommand);

    symlink = lsCommand.getSymlink();

    return symlink;
  }
Beispiel #2
0
  /**
   * @param file String that represent the file, including the full path to the file and its name.
   * @return File permissions as String, for example: 777, returns null on error
   * @throws IOException
   * @throws TimeoutException
   * @throws BrokenBusyboxException
   */
  public String getFilePermissions(String file)
      throws FailedExecuteCommand, BrokenBusyboxException, IOException {
    Log.d(RootCommands.TAG, "Checking permissions for " + file);

    String permissions = null;

    if (fileExists(file)) {
      Log.d(RootCommands.TAG, file + " was found.");

      LsCommand lsCommand = new LsCommand(file);

      shell.execCommand(lsCommand);

      permissions = lsCommand.getPermissions();
    }

    return permissions;
  }