From 54e289ce56e5ac97e95ecd882c145c6fc622fe14 Mon Sep 17 00:00:00 2001 From: DLmaster361 Date: Wed, 3 Sep 2025 22:06:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=80=9A=E7=94=A8?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=80=89=E6=8B=A9=E6=97=A0=E6=B3=95=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/core/config.py | 20 +++++--- app/models/ConfigBase.py | 4 +- frontend/src/views/History.vue | 6 +-- frontend/src/views/ScriptEdit.vue | 78 +++++++++++++++++++++---------- 4 files changed, 70 insertions(+), 38 deletions(-) diff --git a/app/core/config.py b/app/core/config.py index a3cbd54..0edb465 100644 --- a/app/core/config.py +++ b/app/core/config.py @@ -229,7 +229,9 @@ class MaaUserConfig(ConfigBase): "Normal", OptionsValidator(["Normal", "Rotation", "Custom"]), ) - self.Info_InfrastPath = ConfigItem("Info", "InfrastPath", ".", FileValidator()) + self.Info_InfrastPath = ConfigItem( + "Info", "InfrastPath", str(Path.cwd()), FileValidator() + ) self.Info_Password = ConfigItem("Info", "Password", "", EncryptValidator()) self.Info_Notes = ConfigItem("Info", "Notes", "无") self.Info_MedicineNumb = ConfigItem( @@ -337,7 +339,7 @@ class MaaConfig(ConfigBase): super().__init__() self.Info_Name = ConfigItem("Info", "Name", "新 MAA 脚本") - self.Info_Path = ConfigItem("Info", "Path", ".", FolderValidator()) + self.Info_Path = ConfigItem("Info", "Path", str(Path.cwd()), FolderValidator()) self.Run_TaskTransitionMethod = ConfigItem( "Run", @@ -500,17 +502,19 @@ class GeneralConfig(ConfigBase): super().__init__() self.Info_Name = ConfigItem("Info", "Name", "新通用脚本") - self.Info_RootPath = ConfigItem("Info", "RootPath", ".", FileValidator()) + self.Info_RootPath = ConfigItem( + "Info", "RootPath", str(Path.cwd()), FileValidator() + ) self.Script_ScriptPath = ConfigItem( - "Script", "ScriptPath", ".", FileValidator() + "Script", "ScriptPath", str(Path.cwd()), FileValidator() ) self.Script_Arguments = ConfigItem("Script", "Arguments", "") self.Script_IfTrackProcess = ConfigItem( "Script", "IfTrackProcess", False, BoolValidator() ) self.Script_ConfigPath = ConfigItem( - "Script", "ConfigPath", ".", FileValidator() + "Script", "ConfigPath", str(Path.cwd()), FileValidator() ) self.Script_ConfigPathMode = ConfigItem( "Script", "ConfigPathMode", "File", OptionsValidator(["File", "Folder"]) @@ -521,7 +525,9 @@ class GeneralConfig(ConfigBase): "Never", OptionsValidator(["Never", "Success", "Failure", "Always"]), ) - self.Script_LogPath = ConfigItem("Script", "LogPath", ".", FileValidator()) + self.Script_LogPath = ConfigItem( + "Script", "LogPath", str(Path.cwd()), FileValidator() + ) self.Script_LogPathFormat = ConfigItem("Script", "LogPathFormat", "%Y-%m-%d") self.Script_LogTimeStart = ConfigItem( "Script", "LogTimeStart", 1, RangeValidator(1, 9999) @@ -539,7 +545,7 @@ class GeneralConfig(ConfigBase): self.Game_Type = ConfigItem( "Game", "Type", "Emulator", OptionsValidator(["Emulator", "Client"]) ) - self.Game_Path = ConfigItem("Game", "Path", ".", FileValidator()) + self.Game_Path = ConfigItem("Game", "Path", str(Path.cwd()), FileValidator()) self.Game_Arguments = ConfigItem("Game", "Arguments", "") self.Game_WaitTime = ConfigItem("Game", "WaitTime", 0, RangeValidator(0, 9999)) self.Game_IfForceClose = ConfigItem( diff --git a/app/models/ConfigBase.py b/app/models/ConfigBase.py index d49a43d..2367372 100644 --- a/app/models/ConfigBase.py +++ b/app/models/ConfigBase.py @@ -134,7 +134,7 @@ class FileValidator(ConfigValidator): def correct(self, value: Any) -> str: if not isinstance(value, str): - value = "." + value = str(Path.cwd()) if not Path(value).is_absolute(): value = Path(value).resolve().as_posix() if Path(value).suffix == ".lnk": @@ -159,7 +159,7 @@ class FolderValidator(ConfigValidator): def correct(self, value: Any) -> str: if not isinstance(value, str): - value = "." + value = str(Path.cwd()) return Path(value).resolve().as_posix() diff --git a/frontend/src/views/History.vue b/frontend/src/views/History.vue index c9b1960..576146c 100644 --- a/frontend/src/views/History.vue +++ b/frontend/src/views/History.vue @@ -92,11 +92,7 @@
- - - + 无数据
diff --git a/frontend/src/views/ScriptEdit.vue b/frontend/src/views/ScriptEdit.vue index 89632b5..71bf54d 100644 --- a/frontend/src/views/ScriptEdit.vue +++ b/frontend/src/views/ScriptEdit.vue @@ -394,7 +394,7 @@ - 所有文件 (*) + 单文件 文件夹 @@ -825,7 +826,7 @@