This commit is contained in:
huangyuhui
2016-04-06 19:41:33 +08:00
parent 16152de39d
commit ce24ae4fae
2 changed files with 11 additions and 1 deletions

View File

@@ -19,6 +19,7 @@ package org.jackhuang.hellominecraft.launcher.core.version;
import org.jackhuang.hellominecraft.launcher.core.download.DownloadType;
import org.jackhuang.hellominecraft.util.StrUtils;
import org.jackhuang.hellominecraft.util.system.IOUtils;
/**
*
@@ -38,7 +39,7 @@ public class LibraryDownloadInfo extends GameDownloadInfo {
if (path == null)
return null;
else
myURL += path.replace('\\', '/');
myURL = IOUtils.addURLSeparator(myURL) + path.replace('\\', '/');
return myURL;
}
}

View File

@@ -54,6 +54,15 @@ public class IOUtils {
return path + File.separatorChar;
}
public static String addURLSeparator(String path) {
if (path == null || path.trim().length() == 0)
return "";
if (path.charAt(path.length() - 1) == '/')
return path;
else
return path + '/';
}
public static boolean isSeparator(char ch) {
return ch == File.separatorChar || ch == '/' || ch == '\\';
}