mirror of
https://github.com/TonyJiangWJ/Auto.js.git
synced 2026-06-21 21:01:43 +08:00
opt(dev_plugin): add require path to remote script; optimize saved remote script's name
This commit is contained in:
parent
af5bf8ecf2
commit
7a4eb33245
@ -100,7 +100,8 @@ public class Scripts {
|
||||
|
||||
public static ScriptExecution run(ScriptSource source) {
|
||||
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) {
|
||||
|
||||
@ -71,7 +71,7 @@ public class DevPluginResponseHandler implements Handler {
|
||||
} else {
|
||||
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) {
|
||||
@ -96,9 +96,7 @@ public class DevPluginResponseHandler implements Handler {
|
||||
}
|
||||
name = PFiles.getNameWithoutExtension(name);
|
||||
if (!name.endsWith(".js")) {
|
||||
name = "<remote>" + name + ".js";
|
||||
} else {
|
||||
name = "<remote>" + name;
|
||||
name = name + ".js";
|
||||
}
|
||||
PFiles.write(StorageFileProvider.DEFAULT_DIRECTORY_PATH + name, script);
|
||||
GlobalAppContext.toast(R.string.text_script_save_successfully);
|
||||
|
||||
@ -349,6 +349,7 @@ public class PFiles {
|
||||
}
|
||||
|
||||
public static String getName(String filePath) {
|
||||
filePath = filePath.replace('\\', '/');
|
||||
return new File(filePath).getName();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user