class FileSystem {

	@Pure
	public static URL dirname(File filename) {
		if (filename == null) {
			return null;
		}
		String parent = fromFileStandardToURLStandard(filename.getParent());
		try {
			if (parent == null || "".equals(parent)) { //$NON-NLS-1$
				if (filename.isAbsolute()) {
					return null;
				}
				return new URL(URISchemeType.FILE.name(), "", CURRENT_DIRECTORY); //$NON-NLS-1$
			}
			// Treat Windows specific.
			if (Pattern.matches("^" + URL_PATH_SEPARATOR + "?[a-zA-Z][:|]$", parent)) { //$NON-NLS-1$ //$NON-NLS-2$
				parent += URL_PATH_SEPARATOR;
			}
			return new URL(URISchemeType.FILE.name(), "", parent); //$NON-NLS-1$
		} catch (MalformedURLException exception) {
			return null;
		}
	}

	private  FileSystem();

}