feat: compatible symbolic links require
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -52,3 +52,4 @@ vendor/
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Minecraft Data
 | 
					# Minecraft Data
 | 
				
			||||||
/world
 | 
					/world
 | 
				
			||||||
 | 
					**/node_modules/
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,10 +1,14 @@
 | 
				
			|||||||
/**
 | 
					/**
 | 
				
			||||||
 * 补丁和方法扩展
 | 
					 * 补丁和方法扩展
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
(function () {
 | 
					(function() {
 | 
				
			||||||
    // Java格式化方法
 | 
					    // Java格式化方法
 | 
				
			||||||
    var str = Java.type('java.lang.String');
 | 
					    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))
 | 
					        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;
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
})();
 | 
					})();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -60,6 +60,17 @@
 | 
				
			|||||||
        return file.canonicalPath;
 | 
					        return file.canonicalPath;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获得文件绝对路径
 | 
				
			||||||
 | 
					     * @param file
 | 
				
			||||||
 | 
					     * @returns {*}
 | 
				
			||||||
 | 
					     * @private
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    function _absolute(file) {
 | 
				
			||||||
 | 
					        // noinspection JSUnresolvedVariable
 | 
				
			||||||
 | 
					        return file.absolutePath;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 获得缓存的文件名称
 | 
					     * 获得缓存的文件名称
 | 
				
			||||||
     * @param file
 | 
					     * @param file
 | 
				
			||||||
@@ -67,7 +78,7 @@
 | 
				
			|||||||
     * @private
 | 
					     * @private
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    function _cacheFile(file) {
 | 
					    function _cacheFile(file) {
 | 
				
			||||||
        return _canonical(file).replace(parent, cacheDir);
 | 
					        return _absolute(file).replace(parent, cacheDir);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -108,12 +119,12 @@
 | 
				
			|||||||
            return file;
 | 
					            return file;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // JS文件
 | 
					        // JS文件
 | 
				
			||||||
        var js = new File(normalizeName(_canonical(file), ".js"));
 | 
					        var js = new File(normalizeName(_absolute(file), ".js"));
 | 
				
			||||||
        if (js.isFile()) {
 | 
					        if (js.isFile()) {
 | 
				
			||||||
            return js;
 | 
					            return js;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        // JSON文件
 | 
					        // JSON文件
 | 
				
			||||||
        var json = new File(normalizeName(_canonical(file), ".json"));
 | 
					        var json = new File(normalizeName(_absolute(file), ".json"));
 | 
				
			||||||
        if (json.isFile()) {
 | 
					        if (json.isFile()) {
 | 
				
			||||||
            return json;
 | 
					            return json;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user