Browse Source

fix electron read config.js

Michael Wang 6 năm trước cách đây
mục cha
commit
a93a3e7403
1 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 3 2
      src/features/Login/Login.vue

+ 3 - 2
src/features/Login/Login.vue

@@ -113,7 +113,8 @@ export default {
     if (typeof nodeRequire != "undefined") {
       var that = this;
       var fs = nodeRequire("fs");
-      var config = fs.readFileSync(process.cwd() + "/" + "config.js", "utf-8");
+      var path = nodeRequire("path");
+      var config = fs.readFileSync(path.join(__dirname, "/config.js"), "utf-8");
       var nameJson = JSON.parse(config);
       const electronConfig = (await this.$http.get(
         "https://ecs.qmth.com.cn:8878/electron-config/" + nameJson.name + ".js"
@@ -123,7 +124,7 @@ export default {
       if (electronConfig.otherConfig.checkRomateControl) {
         nodeRequire("node-cmd").get("Project1.exe", function(data) {
           var applicationNames = fs.readFileSync(
-            "remoteApplication.txt",
+            path.join(__dirname, "/remoteApplication.txt"),
             "utf-8"
           );
           if (applicationNames && applicationNames.trim()) {