apply plugin retrolambda
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
|
||||
module.exports = function(__runtime__, scope){
|
||||
scope.files = com.stardust.pio.PFile;
|
||||
var files = com.stardust.pio.PFiles;
|
||||
scope.files = files;
|
||||
scope.open = function(path, mode, encoding, bufferSize){
|
||||
if(arguments.length == 1){
|
||||
return com.stardust.pio.PFile.open(path);
|
||||
return files.open(path);
|
||||
}else if(arguments.length == 2){
|
||||
return com.stardust.pio.PFile.open(path, mode);
|
||||
return files.open(path, mode);
|
||||
}else if(arguments.length == 3){
|
||||
return com.stardust.pio.PFile.open(path, mode, encoding);
|
||||
return files.open(path, mode, encoding);
|
||||
}else if(arguments.length == 4){
|
||||
return com.stardust.pio.PFile.open(path, mode, encoding, bufferSize);
|
||||
return files.open(path, mode, encoding, bufferSize);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
var __require__ = require;
|
||||
var __nodejs_modules__ = {
|
||||
'websocket' : com.iwebpp.wspp.WebSocket,
|
||||
'websocketserver': com.iwebpp.wspp.WebSocketServer,
|
||||
'net': com.iwebpp.node.net.TCP,
|
||||
'tcp': com.iwebpp.node.net.TCP,
|
||||
'udt': com.iwebpp.node.net.UDT,
|
||||
'readable': com.iwebpp.node.stream.Readable2,
|
||||
'writable': com.iwebpp.node.stream.Writable2,
|
||||
'duplex': com.iwebpp.node.stream.Duplex,
|
||||
'transform': com.iwebpp.node.stream.Transform,
|
||||
'passthrough': com.iwebpp.node.stream.PassThrough,
|
||||
'dns': com.iwebpp.node.Dns,
|
||||
'url': com.iwebpp.node.Url,
|
||||
}
|
||||
|
||||
var require = function(module){
|
||||
if (module === 'http'){
|
||||
return {
|
||||
get: function(url, listener){
|
||||
return com.iwebpp.node.http.http.get(NodeCurrentContext, url, listener);
|
||||
},
|
||||
request: function(url, listener) {
|
||||
return com.iwebpp.node.http.http.request(NodeCurrentContext, url, listener);
|
||||
},
|
||||
createServer: function(listener) {
|
||||
return com.iwebpp.node.http.http.createServer(NodeCurrentContext, listener);
|
||||
},
|
||||
};
|
||||
}
|
||||
if (module === 'httpp'){
|
||||
return {
|
||||
get: function(url, listener){
|
||||
return com.iwebpp.node.http.httpp.get(NodeCurrentContext, url, listener);
|
||||
},
|
||||
request: function(url, listener) {
|
||||
return com.iwebpp.node.http.httpp.request(NodeCurrentContext, url, listener);
|
||||
},
|
||||
createServer: function(listener) {
|
||||
return com.iwebpp.node.http.httpp.createServer(NodeCurrentContext, listener);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
return __require__(module);
|
||||
};
|
||||
@@ -8,7 +8,7 @@ import com.stardust.autojs.rhino.RhinoAndroidHelper;
|
||||
import com.stardust.autojs.runtime.exception.ScriptInterruptedException;
|
||||
import com.stardust.autojs.script.JavaScriptSource;
|
||||
import com.stardust.autojs.script.StringScriptSource;
|
||||
import com.stardust.pio.PFile;
|
||||
import com.stardust.pio.PFiles;
|
||||
import com.stardust.pio.UncheckedIOException;
|
||||
|
||||
import org.mozilla.javascript.Context;
|
||||
@@ -106,7 +106,7 @@ public class RhinoJavaScriptEngine extends JavaScriptEngine {
|
||||
|
||||
private String readInitScript() {
|
||||
try {
|
||||
return PFile.read(mAndroidContext.getAssets().open("javascript_engine_init.js"));
|
||||
return PFiles.read(mAndroidContext.getAssets().open("javascript_engine_init.js"));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
@@ -7,11 +7,8 @@ import android.util.Log;
|
||||
import com.stardust.autojs.runtime.api.AbstractShell;
|
||||
import com.stardust.autojs.runtime.api.ProcessShell;
|
||||
import com.stardust.autojs.core.inputevent.InputDevices;
|
||||
import com.stardust.autojs.runtime.api.Shell;
|
||||
import com.stardust.autojs.runtime.exception.ScriptInterruptedException;
|
||||
import com.stardust.autojs.script.AutoFileSource;
|
||||
import com.stardust.concurrent.VolatileBox;
|
||||
import com.stardust.pio.PFile;
|
||||
import com.stardust.pio.PFiles;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@@ -71,7 +68,7 @@ public class RootAutomatorEngine extends ScriptEngine.AbstractScriptEngine<AutoF
|
||||
|
||||
public static String getExecutablePath(Context context) {
|
||||
File tmp = new File(context.getCacheDir(), "root_automator");
|
||||
PFile.copyAsset(context, ROOT_AUTOMATOR_EXECUTABLE_ASSET, tmp.getAbsolutePath());
|
||||
PFiles.copyAsset(context, ROOT_AUTOMATOR_EXECUTABLE_ASSET, tmp.getAbsolutePath());
|
||||
return tmp.getAbsolutePath();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.stardust.util.IntentUtil;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.List;
|
||||
|
||||
import static com.stardust.pio.PFile.getExtension;
|
||||
import static com.stardust.pio.PFiles.getExtension;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/4/2.
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.stardust.autojs.script;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.stardust.pio.PFile;
|
||||
import com.stardust.pio.PFiles;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.Reader;
|
||||
|
||||
/**
|
||||
* Created by Stardust on 2017/8/2.
|
||||
@@ -17,7 +14,7 @@ public class AutoFileSource extends ScriptSource {
|
||||
private File mFile;
|
||||
|
||||
public AutoFileSource(File file) {
|
||||
super(PFile.getNameWithoutExtension(file.getAbsolutePath()));
|
||||
super(PFiles.getNameWithoutExtension(file.getAbsolutePath()));
|
||||
mFile = file;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.stardust.autojs.script;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import com.stardust.pio.PFile;
|
||||
import com.stardust.pio.PFiles;
|
||||
import com.stardust.pio.UncheckedIOException;
|
||||
|
||||
import java.io.File;
|
||||
@@ -20,7 +20,7 @@ public class JavaScriptFileSource extends JavaScriptSource {
|
||||
private String mScript;
|
||||
|
||||
public JavaScriptFileSource(File file) {
|
||||
super(PFile.getNameWithoutExtension(file.getName()));
|
||||
super(PFiles.getNameWithoutExtension(file.getName()));
|
||||
mFile = file;
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class JavaScriptFileSource extends JavaScriptSource {
|
||||
@Override
|
||||
public String getScript() {
|
||||
if (mScript == null)
|
||||
mScript = PFile.read(mFile);
|
||||
mScript = PFiles.read(mFile);
|
||||
return mScript;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.stardust.autojs.script;
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.stardust.pio.PFile;
|
||||
import com.stardust.pio.PFiles;
|
||||
import com.stardust.pio.UncheckedIOException;
|
||||
|
||||
import org.mozilla.javascript.Function;
|
||||
@@ -102,7 +102,7 @@ public class JsBeautifier {
|
||||
InputStream is = mContext.getAssets().open(mBeautifyJsPath);
|
||||
if (mScriptable == null)
|
||||
mScriptable = mScriptContext.initSafeStandardObjects();
|
||||
mJsBeautifyFunction = mScriptContext.compileFunction(mScriptable, PFile.read(is), "<js_beautify>", 1, null);
|
||||
mJsBeautifyFunction = mScriptContext.compileFunction(mScriptable, PFiles.read(is), "<js_beautify>", 1, null);
|
||||
} catch (IOException e) {
|
||||
exitContext();
|
||||
throw new UncheckedIOException(e);
|
||||
|
||||
Reference in New Issue
Block a user