Gets the directory name of the canonical path -- the last element in the result of
{@link #getCanonicalPath(String)}.
@param path path to canonicalize
@return canonical directory name
162349
public static String getCanonicalDirectoryName(String path) {
        String realPath = getCanonicalPath(path);
        if (realPath == null) {
            return null;
        }

        String separator = System.getProperty("file.separator", "/");
        // backslashes must be escaped for split().  kthxbai
        separator = Pattern.quote(separator);
        String[] pathElements = realPath.split(separator);
        return pathElements.length > 0 ? pathElements[pathElements.length - 1] : realPath;
    }
966341
public String getRealPath(String path) {
        if (context != null) {
            return context.getRealPath(path);
        }
        return path;
    }
180506
public static String getArtefactDirectory(String path) {

        if (path != null) {
            final Matcher matcher = RESOURCE_PATH_PATTERN.matcher(path);
            if (matcher.find()) {
                return matcher.group(1);
            }
        }
        return null;
    }
839002
@Nullable
    public final File getCanonicalDir() {
        final String dir = getDirectory();
        if (dir == null) {
            return null;
        }
        try {
            return new File(dir).getCanonicalFile();
        } catch (final IOException ex) {
            throw new RuntimeException("Couldn't determine canonical file: " + dir, ex);
        }
    }
9888
public static String getFilename(String path) {
        //The filename is after the last slash
        final int index = path != null ? path.lastIndexOf("/") : -1;
        if (index == -1) {
            IOException ioe = new IOException(TraceNLS.getFormattedMessage(FileTransferHelper.class,
                                                                           APIConstants.TRACE_BUNDLE_FILE_TRANSFER,
                                                                           "PATH_NOT_VALID",
                                                                           new String[] { path },
                                                                           "CWWKX0127E: The path " + path + " is not valid."));
            throw ErrorHelper.createRESTHandlerJsonException(ioe, null, APIConstants.STATUS_BAD_REQUEST);
        }

        return path.substring(index + 1);
    }
116850
public static String getName(String path)
   {
      int pos = path.lastIndexOf('/');
      return pos >= 0 ? path.substring(pos + 1) : "";
   }
77971
public static String nativeDirectorySeparator(final String path) {
    if (path == null)
      return StringUtil.empty;
    return path.replace("/", directorySeparator).replace("\\", directorySeparator);
  }
536519
protected String getLocalePath (String path)
    {
        return (_localeHandler == null) ? null : _localeHandler.getLocalePath(path);
    }
504500
public static String getFileName(String filePath) {
		if (filePath == null) {
			return filePath;
		}
		int index = filePath.lastIndexOf(File.separator);
		if (index == -1) {
			return filePath;
		}
		return filePath.substring(index + 1);
	}
208819
public String getBasename(String path) {
		int sepIdx = path.lastIndexOf(WEB_SEPARATOR_CHAR);
		if(sepIdx != -1) {
			return path.substring(sepIdx + 1);
		}
		return path;
	}
423552
public static String getClassNameForClassFile(String rootDir, String path) {
        path = path.replace("/", ".");
        path = path.replace('\\', '.');
        path = path.substring(0, path.length() - CLASS_EXTENSION.length());
        if (rootDir != null) {
            path = path.substring(rootDir.length());
        }
        return path;
    }
701480
public String getBaseDirectory(String path) {
    if (path != null) {
      int finishIndex = path.indexOf(HADOOP_TEMPORARY);
      if (finishIndex > 0) {
        String newPath = path.substring(0, finishIndex);
        if (newPath.endsWith("/")) {
          return newPath.substring(0, newPath.length() - 1);
        }
        return newPath;
      }
    }
    return path;
  }
1220979
public String lookupRelativeNativePath(PathImpl path)
  {
    String thisNative = getNativePath();
    String pathNative = path.getNativePath();

    if (pathNative.startsWith(thisNative)) {
      int i = thisNative.length();

      while (i < pathNative.length()) {
        if (pathNative.charAt(i) != getFileSeparatorChar())
          break;

        i++;
      }

      return i == pathNative.length() ? "" : pathNative.substring(i);
    }
    else
      return pathNative;
  }
212843
public static String getClassName(String path) {
        for (Pattern pattern : patterns) {
            Matcher m = pattern.matcher(path);
            if (m.find()) {
                return m.group(1).replaceAll("[/\\\\]", ".");
            }
        }
        return null;
    }
297226
public CMFolder getFolder( CPath path )
    {
        List<String> baseNames = path.split();

        if (path.isRoot() ){
            return this;
        }

        CMFolder currentFolder = this;
        CMFolder subFolder = null;

        for ( String baseName : baseNames ) {
            subFolder = currentFolder.getChildByName( baseName );

            if ( subFolder == null ) {
                return null;
            }

            currentFolder = subFolder;
        }

        return subFolder;
    }
1232727
public static String canonical(File p) {
		try {
			return p.getCanonicalPath();
		} catch (IOException e) {
			String x = p.getAbsolutePath();
			return x == null ? p.getPath() : x;
		}
	}
508054
String getItemName(URI path) {
    Preconditions.checkNotNull(path);

    // There is no leaf item for the root path.
    if (path.equals(GCS_ROOT)) {
      return null;
    }

    StorageResourceId resourceId = pathCodec.validatePathAndGetId(path, true);

    if (resourceId.isBucket()) {
      return resourceId.getBucketName();
    }

    int index;
    String objectName = resourceId.getObjectName();
    if (FileInfo.objectHasDirectoryPath(objectName)) {
      index = objectName.lastIndexOf(PATH_DELIMITER, objectName.length() - 2);
    } else {
      index = objectName.lastIndexOf(PATH_DELIMITER);
    }
    return index < 0 ? objectName : objectName.substring(index + 1);
  }