feat: compatible symbolic links require

merge/3/MERGE
MiaoWoo 2019-09-01 23:58:07 +08:00
parent 2d4bc3dd24
commit 160e7f4118
3 changed files with 22 additions and 6 deletions

3
.gitignore vendored
View File

@ -51,4 +51,5 @@
vendor/
# Minecraft Data
/world
/world
**/node_modules/

View File

@ -1,10 +1,14 @@
/**
* 补丁和方法扩展
*/
(function () {
(function() {
// Java格式化方法
var str = Java.type('java.lang.String');
String.prototype.format = function () {
String.prototype.format = function() {
return str.format(this, Array.prototype.slice.call(arguments, 0))
};
var indexOf = String.prototype.indexOf;
String.prototype.contains = function(searchString/*, position*/) {
return indexOf.call(this, searchString, arguments[1]) > -1;
};
})();

View File

@ -60,6 +60,17 @@
return file.canonicalPath;
}
/**
* 获得文件绝对路径
* @param file
* @returns {*}
* @private
*/
function _absolute(file) {
// noinspection JSUnresolvedVariable
return file.absolutePath;
}
/**
* 获得缓存的文件名称
* @param file
@ -67,7 +78,7 @@
* @private
*/
function _cacheFile(file) {
return _canonical(file).replace(parent, cacheDir);
return _absolute(file).replace(parent, cacheDir);
}
/**
@ -108,12 +119,12 @@
return file;
}
// JS文件
var js = new File(normalizeName(_canonical(file), ".js"));
var js = new File(normalizeName(_absolute(file), ".js"));
if (js.isFile()) {
return js;
}
// JSON文件
var json = new File(normalizeName(_canonical(file), ".json"));
var json = new File(normalizeName(_absolute(file), ".json"));
if (json.isFile()) {
return json;
}