alroyso 1 month ago
parent
commit
dbd6710d71

+ 2 - 1
lib/app/clash/service/clash_service.dart

@@ -108,7 +108,7 @@ class ClashService extends GetxController {
 
     try {
       controllers.global.updateMsg("启动内核---${controllers.config.config.value.selected}");
-      if (controllers.config.config.value.selected == 'init_proxy.yaml') {
+      if (controllers.config.config.value.selected == controllers.config.config.value.selected) {
         controllers.global.updateMsg("启动内核初始化");
       } else {
         controllers.global.updateMsg("启动内核");
@@ -351,6 +351,7 @@ class ClashService extends GetxController {
       final file = File(filePath);
       await file.writeAsString(configYaml);
       print('配置文件已成功保存到: $filePath');
+
     } catch (e) {
       print('保存配置文件时发生错误: $e');
       throw Exception('无法保存配置文件');

+ 3 - 3
lib/app/controller/GlobalController.dart

@@ -106,11 +106,11 @@ class GlobalController extends GetxController {
         }
         
         // 确保初始配置文件存在并设置为当前配置
-        final initProxyConfig = File(path.join(Paths.config.path, Files.makeInitProxyConfig.path));
+        final initProxyConfig = File(path.join(Paths.config.path, Files.makeProxyConfig.path));
         if (!await initProxyConfig.exists()) {
-          await controllers.service.makeInitConfig();
+          await makeProxy();
         }
-        controllers.config.config.value.selected = Files.makeInitProxyConfig.path;
+        controllers.config.config.value.selected = Files.makeProxyConfig.path;
         
         if (Platform.isWindows) {
           await controllers.service.startClashCore();