提交 6d129986 authored 作者: Thomas Mueller's avatar Thomas Mueller

Improved compatibility with the Java 7 FileSystem abstraction.

上级 bbf6e17f
......@@ -42,11 +42,13 @@ public abstract class FilePath {
/**
* Get the file path object for the given path.
* Windows-style '\' is replaced with '/'.
*
* @param path the path
* @return the file path object
*/
public static FilePath get(String path) {
path = path.replace('\\', '/');
int index = path.indexOf(':');
if (index < 2) {
// use the default provider if no prefix or
......
......@@ -43,19 +43,20 @@ public class FilePathDisk extends FilePath {
}
/**
* Translate the file name to the native format.
* This will expand the home directory (~).
* Translate the file name to the native format. This will replace '\' with
* '/' and expand the home directory ('~').
*
* @param fileName the file name
* @return the native file name
*/
protected static String translateFileName(String fileName) {
fileName = fileName.replace('\\', '/');
return expandUserHomeDirectory(fileName);
}
/**
* Expand '~' to the user home directory. It is only be expanded if the ~
* stands alone, or is followed by / or \.
* Expand '~' to the user home directory. It is only be expanded if the '~'
* stands alone, or is followed by '/' or '\'.
*
* @param fileName the file name
* @return the native file name
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论