opt(dev_plugin): add require path to remote script; optimize saved remote script's name
This commit is contained in:
@@ -100,7 +100,8 @@ public class Scripts {
|
|||||||
|
|
||||||
public static ScriptExecution run(ScriptSource source) {
|
public static ScriptExecution run(ScriptSource source) {
|
||||||
return AutoJs.getInstance().getScriptEngineService().execute(source, new ExecutionConfig()
|
return AutoJs.getInstance().getScriptEngineService().execute(source, new ExecutionConfig()
|
||||||
.executePath(StorageFileProvider.DEFAULT_DIRECTORY_PATH));
|
.executePath(StorageFileProvider.DEFAULT_DIRECTORY_PATH)
|
||||||
|
.requirePath(StorageFileProvider.DEFAULT_DIRECTORY_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ScriptExecution runWithBroadcastSender(File file) {
|
public static ScriptExecution runWithBroadcastSender(File file) {
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public class DevPluginResponseHandler implements Handler {
|
|||||||
} else {
|
} else {
|
||||||
name = PFiles.getNameWithoutExtension(name);
|
name = PFiles.getNameWithoutExtension(name);
|
||||||
}
|
}
|
||||||
mScriptExecutions.put(viewId, Scripts.run(new StringScriptSource("<remote>:" + name, script)));
|
mScriptExecutions.put(viewId, Scripts.run(new StringScriptSource("[remote]" + name, script)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void stopScript(String viewId) {
|
private void stopScript(String viewId) {
|
||||||
@@ -96,9 +96,7 @@ public class DevPluginResponseHandler implements Handler {
|
|||||||
}
|
}
|
||||||
name = PFiles.getNameWithoutExtension(name);
|
name = PFiles.getNameWithoutExtension(name);
|
||||||
if (!name.endsWith(".js")) {
|
if (!name.endsWith(".js")) {
|
||||||
name = "<remote>" + name + ".js";
|
name = name + ".js";
|
||||||
} else {
|
|
||||||
name = "<remote>" + name;
|
|
||||||
}
|
}
|
||||||
PFiles.write(StorageFileProvider.DEFAULT_DIRECTORY_PATH + name, script);
|
PFiles.write(StorageFileProvider.DEFAULT_DIRECTORY_PATH + name, script);
|
||||||
GlobalAppContext.toast(R.string.text_script_save_successfully);
|
GlobalAppContext.toast(R.string.text_script_save_successfully);
|
||||||
|
|||||||
@@ -349,6 +349,7 @@ public class PFiles {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String getName(String filePath) {
|
public static String getName(String filePath) {
|
||||||
|
filePath = filePath.replace('\\', '/');
|
||||||
return new File(filePath).getName();
|
return new File(filePath).getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user