public boolean changeWorkingDirectory()

in pekko-connectors-sample-rotate-logs-to-ftp/src/main/java/playground/filesystem/impl/JimfsView.java [113:130]


  public boolean changeWorkingDirectory(String dir) throws FtpException {

    // not a directory - return false
    dir = getPhysicalName(dir);
    Path dirPath = fileSystem.getPath(dir);
    if (!Files.isDirectory(dirPath)) {
      return false;
    }

    // strip user root and add last '/' if necessary
    dir = dir.substring(rootDir.length() - 1);
    if (dir.charAt(dir.length() - 1) != '/') {
      dir = dir + '/';
    }

    currDir = dir;
    return true;
  }