feat: update plugins

Signed-off-by: MiaoWoo <admin@yumc.pw>
backup
MiaoWoo 2020-01-16 17:27:24 +08:00
parent 54d12749dc
commit e442da5b3b
2 changed files with 11 additions and 10 deletions

View File

@ -17,6 +17,7 @@ declare global {
function engineLoad(str: string): any;
interface Core {
getClass(name: String): any;
getProxyClass(): any;
getInstance(): any;
read(path: string): string;
save(path: string, content: string): void;

View File

@ -12,8 +12,8 @@ const StandardCopyOption = Java.type("java.nio.file.StandardCopyOption");
/**
*
*/
export function concat() {
return Array.prototype.join.call(arguments, separatorChar);
export function concat(...args: string[]) {
return args.join(separatorChar);
}
/**
@ -23,12 +23,12 @@ export function concat() {
* @returns {*}
*/
export function file(...opts: any[]): any {
if (!arguments[0]) {
if (!opts[0]) {
console.warn("文件名称不得为 undefined 或者 null !");
}
switch (arguments.length) {
switch (opts.length) {
case 1:
var f = arguments[0];
var f = opts[0];
if (f instanceof File) {
return f;
}
@ -40,7 +40,7 @@ export function file(...opts: any[]): any {
}
break;
default:
return new File(file(arguments[0]), arguments[1]);
return new File(file(opts[0]), opts[1]);
}
}
@ -48,7 +48,7 @@ export function file(...opts: any[]): any {
*
* @param path
*/
export function mkdirs(path) {
export function mkdirs(path: any) {
// noinspection JSUnresolvedVariable
file(path).parentFile.mkdirs();
}
@ -57,7 +57,7 @@ export function mkdirs(path) {
*
* @param file
*/
export function create(path) {
export function create(path: any) {
var f = file(path);
if (!f.exists()) {
mkdirs(f);
@ -70,7 +70,7 @@ export function create(path) {
* @param file
* @returns {*}
*/
export function path(f) {
export function path(f: any) {
return file(f).canonicalPath;
}
@ -80,7 +80,7 @@ export function path(f) {
* @param target
* @param override
*/
export function copy(inputStream, target, override) {
export function copy(inputStream: any, target: any, override: any) {
Files.copy(inputStream, target.toPath(), StandardCopyOption[override ? 'REPLACE_EXISTING' : 'ATOMIC_MOVE']);
}