filecat 7.9.0 → 7.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. package/LICENSE +201 -201
  2. package/README.md +173 -182
  3. package/build/dist/{4967.3fd3bd40a2b5a3b52428.js → 1060.198d91e2dfc174317c3a.js} +1 -1
  4. package/build/dist/1075.05eed88707339ca32044.js +1 -0
  5. package/build/dist/{1142.121454b1de53689b7367.js → 1142.bc43fae2e5e38d9359df.js} +1 -1
  6. package/build/dist/1384.edbad9c24d883a59724d.js +1 -0
  7. package/build/dist/1417.d390b18dd58ff5c28160.js +1 -0
  8. package/build/dist/1448.4db495e1389c0c8445b3.js +1 -0
  9. package/build/dist/{3324.22efcb1c431177b1cf5f.js → 1455.26a021eb94e5bdd5bec2.js} +1 -1
  10. package/build/dist/{1636.b6a17252dfd0d22f09a7.js → 1636.b80b1883358e132d3424.js} +1 -1
  11. package/build/dist/{1832.8ea5c3e8288df0b7fd5c.js → 1832.a01933ba5df99576ecc2.js} +1 -1
  12. package/build/dist/2300.c99b1dd4e752cdfd5e32.js +2 -0
  13. package/build/dist/{2300.9e1baa1c0368abe53d96.js.LICENSE.txt → 2300.c99b1dd4e752cdfd5e32.js.LICENSE.txt} +1 -1
  14. package/build/dist/239.f570f06d4b9c020f1013.js +1 -0
  15. package/build/dist/{2479.dcc88b3370f0f1d66e02.js → 2479.294792ef5d360ad64abc.js} +1 -1
  16. package/build/dist/2542.26cb302b60de23166227.js +1 -0
  17. package/build/dist/{259.81bb9e049e5ef587a96f.js → 259.3c0eb22e9b43ffb63c9c.js} +1 -1
  18. package/build/dist/2626.3bcfe1f26d9cb796a925.js +1 -0
  19. package/build/dist/2674.d1bf937289c51ddeceac.js +1 -0
  20. package/build/dist/3233.43bdd7c12ca829d56116.js +1 -0
  21. package/build/dist/3299.de79d172b41af93a8716.js +1 -0
  22. package/build/dist/{6992.f6a07311a638794c24f7.js → 3471.ef3b5dcfe37963034187.js} +1 -1
  23. package/build/dist/{3528.56eeefab6fca5884e2a6.js → 3528.0f8f34028d92fa87c518.js} +1 -1
  24. package/build/dist/{3659.8a31495bb8f38c0ffa7c.js → 3659.dd03dc2ac52a3ff19105.js} +1 -1
  25. package/build/dist/4004.f4c06b50348214eb2962.js +1 -0
  26. package/build/dist/{4560.8ef2e4b60cc86d019dd6.js → 4560.fd9f8cf2d6022b1d3a94.js} +1 -1
  27. package/build/dist/{4903.b5451ed0802b3f7c07b2.js → 4903.070aaa53a243baf05133.js} +1 -1
  28. package/build/dist/{4946.c95d4f426146e0180172.js → 4946.d578f6ba367a742d80bf.js} +2 -2
  29. package/build/dist/4986.f244efce9cf6be21f846.js +1 -0
  30. package/build/dist/5272.1f0dfac07ba202e7d323.js +1 -0
  31. package/build/dist/{5308.052f45c15785487b3766.js → 5308.d1e5ccb49396fc1b026d.js} +1 -1
  32. package/build/dist/{5516.645e4a900df9bdc1806c.js → 5516.88521f3a3c7101c46df3.js} +1 -1
  33. package/build/dist/5614.43bdd7c12ca829d56116.js +1 -0
  34. package/build/dist/{5139.adf9574d9b54a216e041.js → 5709.81f43e3c021fafdfe36f.js} +1 -1
  35. package/build/dist/{5744.e9f1efb88a617b05b709.js → 5744.0f8a0432b73b2eb0a7ff.js} +1 -1
  36. package/build/dist/{5877.ca081c4798194230243c.js → 5877.98d0475aaf4058b9a715.js} +1 -1
  37. package/build/dist/{6247.917e3fbef5dc5fbaf937.js → 6247.525b0b68872036ac2fa6.js} +1 -1
  38. package/build/dist/{7520.fbb0bc2a05cf94e15418.js → 6322.552511b5cb12cd0c821c.js} +1 -1
  39. package/build/dist/6492.17ecd8515fa512ce9306.js +1 -0
  40. package/build/dist/{676.a75318a8b598d8daadf0.js → 676.356039ef6f28f96b8c8b.js} +1 -1
  41. package/build/dist/{6805.bf0c964ab84f0fcc78be.js → 6805.373ac0e7d6555e4a6459.js} +1 -1
  42. package/build/dist/{6919.8cf13c01184b7148b28e.js → 6919.c7cc8617b658198d4924.js} +1 -1
  43. package/build/dist/{7038.4e4fc8e405c56d3080e2.js → 7038.166f915547d27e4dc5e4.js} +1 -1
  44. package/build/dist/{7759.0b68912ff9ef10869f59.js → 7759.7cd3fe8e5d37df25804c.js} +1 -1
  45. package/build/dist/7873.e3098bc6f510e5bea55f.js +1 -0
  46. package/build/dist/7923.d44556578af4d3d7cea3.js +2 -0
  47. package/build/dist/{7943.19d2de387eeb7f513d8e.js → 7943.acf25a5e98dd13290985.js} +1 -1
  48. package/build/dist/8090.8977224618a14ae42159.js +2 -0
  49. package/build/dist/8302.ce97557b7cf7c8387942.js +1 -0
  50. package/build/dist/8319.6a6b9651c87a1bb4cbb9.js +1 -0
  51. package/build/dist/{8603.4142ce42c1635f493eca.js → 8603.f1cbcfd64cde885f9809.js} +1 -1
  52. package/build/dist/8649.d6055ad75975b803bbc1.js +1 -0
  53. package/build/dist/{8727.3628c746061aed7a4077.js → 8727.8658835acb7e0b6e5acc.js} +1 -1
  54. package/build/dist/{8765.a5633d054abb67142fc3.js → 8765.8758c290a6b132f2ce7f.js} +1 -1
  55. package/build/dist/8772.2c35012c25ac9eb5f74d.js +2 -0
  56. package/build/dist/{8772.e8f9731c1c061f1cdf56.js.LICENSE.txt → 8772.2c35012c25ac9eb5f74d.js.LICENSE.txt} +1 -1
  57. package/build/dist/8781.6bd14487d172e004e3d3.js +1 -0
  58. package/build/dist/9299.76095cb6629c36ca3343.js +1 -0
  59. package/build/dist/9334.a25983aafdcbde63ae5e.js +1 -0
  60. package/build/dist/{9546.e7206c968e92371ae2b1.js → 9546.2cecad04cf676a6616cd.js} +1 -1
  61. package/build/dist/dark.css +839 -839
  62. package/build/dist/filerobot-image-editor.min.js +42445 -42445
  63. package/build/dist/google-dark.css +2032 -2032
  64. package/build/dist/google.css +1719 -1719
  65. package/build/dist/index.html +1 -1
  66. package/build/dist/main.26c2c54f6ab534513ebd.js +2 -0
  67. package/build/dist/{main.3a12152528aff6ae213a.js.LICENSE.txt → main.26c2c54f6ab534513ebd.js.LICENSE.txt} +1 -1
  68. package/build/dist/rle.js +17867 -17867
  69. package/build/main.js +1 -1
  70. package/build/plugin/core.type.d.ts +62 -0
  71. package/build/threads.work.filecat.js +1 -1
  72. package/env +26 -26
  73. package/package.json +211 -211
  74. package/shell/build.js +161 -161
  75. package/shell/config/.babelrc +14 -14
  76. package/shell/config/base.webpack.config.js +78 -78
  77. package/shell/config/common-bin.config.js +44 -44
  78. package/shell/config/env.js +10 -10
  79. package/shell/config/prebuild-file-path.js +17 -17
  80. package/shell/config/webpack.exe.config.js +36 -36
  81. package/shell/config/webpack.npm.config.js +44 -44
  82. package/shell/config/webpack.web.config.js +152 -152
  83. package/shell/dev.js +51 -51
  84. package/shell/docker-build.sh +2 -2
  85. package/shell/filecat +1 -1
  86. package/shell/filecat-watch +1 -1
  87. package/shell/install.js +48 -48
  88. package/shell/net-agent/git-clone.bat +23 -23
  89. package/shell/net-agent/git-pull.bat +17 -17
  90. package/shell/net-agent/git-push.bat +17 -17
  91. package/shell/pkg.ts +50 -50
  92. package/shell/postinstall-optional.js +29 -29
  93. package/shell/start/filecat-install.sh +22 -22
  94. package/shell/start/filecat-run.sh +2 -2
  95. package/shell/start/windows-install.js +178 -178
  96. package/shell/start/windows-uninstall.js +131 -131
  97. package/shell/util/file.js +46 -46
  98. package/build/dist/1075.40103ec059c6b23b056e.js +0 -1
  99. package/build/dist/1384.0d0fc5faa899c9eddcbe.js +0 -1
  100. package/build/dist/1417.7e511043474084a2a65b.js +0 -1
  101. package/build/dist/1448.0710f04bed1c52e6a5db.js +0 -1
  102. package/build/dist/2300.9e1baa1c0368abe53d96.js +0 -2
  103. package/build/dist/2542.23fb13b1623c9f7c3fc1.js +0 -1
  104. package/build/dist/2626.05d1faa293e0a3318b9b.js +0 -1
  105. package/build/dist/2674.7fd28dae86ccdb247851.js +0 -1
  106. package/build/dist/2851.2195b5906b2c224c7bf7.js +0 -1
  107. package/build/dist/3140.794a212da633caf38b3a.js +0 -2
  108. package/build/dist/3233.fb6bffd5e097e4ac9423.js +0 -1
  109. package/build/dist/3299.f37767d30b6999df4014.js +0 -1
  110. package/build/dist/4004.5d68418ad5c2321cb11f.js +0 -1
  111. package/build/dist/4986.78047106f3a0d2d71199.js +0 -1
  112. package/build/dist/5272.0b70ee8ec5f083fb9f5b.js +0 -1
  113. package/build/dist/5614.fb6bffd5e097e4ac9423.js +0 -1
  114. package/build/dist/6492.3ee4060598de873d8e8f.js +0 -1
  115. package/build/dist/7756.2f851693ba030c42dde8.js +0 -1
  116. package/build/dist/7873.11d04b741d2b499d9cb9.js +0 -1
  117. package/build/dist/7923.861345fd55941e8089a1.js +0 -2
  118. package/build/dist/8014.28b5cf8c3787dc829aa4.js +0 -1
  119. package/build/dist/8302.5ae5bfe8baa0084204bb.js +0 -1
  120. package/build/dist/8319.c15a3674ec7abc493595.js +0 -1
  121. package/build/dist/8772.e8f9731c1c061f1cdf56.js +0 -2
  122. package/build/dist/8781.58f0c51870d3dd2689d7.js +0 -1
  123. package/build/dist/9299.6c06dad1abe098b61766.js +0 -1
  124. package/build/dist/main.3a12152528aff6ae213a.js +0 -2
  125. /package/build/dist/{4946.c95d4f426146e0180172.js.LICENSE.txt → 4946.d578f6ba367a742d80bf.js.LICENSE.txt} +0 -0
  126. /package/build/dist/{7923.861345fd55941e8089a1.js.LICENSE.txt → 7923.d44556578af4d3d7cea3.js.LICENSE.txt} +0 -0
  127. /package/build/dist/{3140.794a212da633caf38b3a.js.LICENSE.txt → 8090.8977224618a14ae42159.js.LICENSE.txt} +0 -0
@@ -1,178 +1,178 @@
1
- const ws = require("windows-shortcuts");
2
- const path = require("path");
3
- const fs = require("fs");
4
- const readline = require("readline");
5
-
6
- // 当前脚本目录
7
- const currentDir = __dirname;
8
-
9
- // 默认安装目录
10
- const defaultInstallDir = "C:\\Filecat";
11
-
12
- // 启动脚本
13
- const CMD_NAME = "filecat-run.cmd";
14
-
15
- // 开始菜单目录
16
- const startMenuDir = path.join(
17
- process.env.APPDATA,
18
- "Microsoft",
19
- "Windows",
20
- "Start Menu",
21
- "Programs",
22
- "Filecat"
23
- );
24
-
25
- // 当前用户开机启动目录
26
- const startupDir = path.join(
27
- process.env.APPDATA,
28
- "Microsoft",
29
- "Windows",
30
- "Start Menu",
31
- "Programs",
32
- "Startup"
33
- );
34
-
35
- // =====================
36
- // 递归复制目录
37
- // =====================
38
- function copyDir(src, dest) {
39
- if (!fs.existsSync(dest)) {
40
- fs.mkdirSync(dest, { recursive: true });
41
- }
42
-
43
- const entries = fs.readdirSync(src, { withFileTypes: true });
44
-
45
- for (let entry of entries) {
46
- const srcPath = path.join(src, entry.name);
47
- const destPath = path.join(dest, entry.name);
48
-
49
- if (entry.isDirectory()) {
50
- copyDir(srcPath, destPath);
51
- } else {
52
- fs.copyFileSync(srcPath, destPath);
53
- }
54
- }
55
- }
56
-
57
- // =====================
58
- // 创建开始菜单快捷方式
59
- // =====================
60
- function createStartMenuShortcut(installDir) {
61
- const cmdPath = path.join(installDir, CMD_NAME);
62
- const shortcutPath = path.join(startMenuDir, "Filecat.lnk");
63
-
64
- fs.mkdirSync(startMenuDir, { recursive: true });
65
-
66
- ws.create(shortcutPath, {
67
- target: cmdPath,
68
- workingDir: installDir,
69
- desc: "Filecat 启动程序"
70
- }, (err) => {
71
- if (err) {
72
- console.error("创建开始菜单快捷方式失败:", err);
73
- } else {
74
- console.log("开始菜单快捷方式创建成功!");
75
- }
76
- });
77
- }
78
-
79
- // =====================
80
- // 创建开机启动快捷方式
81
- // =====================
82
- function createStartupShortcut(installDir) {
83
- const cmdPath = path.join(installDir, CMD_NAME);
84
- const shortcutPath = path.join(startupDir, "Filecat.lnk");
85
-
86
- ws.create(shortcutPath, {
87
- target: cmdPath,
88
- workingDir: installDir,
89
- desc: "Filecat 开机自启"
90
- }, (err) => {
91
- if (err) {
92
- console.error("创建开机自启失败:", err);
93
- } else {
94
- console.log("已加入当前用户开机自启!");
95
- }
96
- });
97
- }
98
-
99
- // =====================
100
- // 安装主流程
101
- // =====================
102
- function install(installDir, askStartup = true) {
103
-
104
- const cmdSrc = path.join(currentDir, CMD_NAME);
105
-
106
- if (!fs.existsSync(cmdSrc)) {
107
- console.error("找不到 filecat-run.cmd");
108
- return;
109
- }
110
-
111
- try {
112
- console.log("正在复制文件...");
113
-
114
- copyDir(currentDir, installDir);
115
-
116
- console.log("文件复制完成");
117
-
118
- createStartMenuShortcut(installDir);
119
-
120
- console.log("安装成功!");
121
- console.log("Win 键搜索 Filecat 即可启动");
122
-
123
- // ===== 询问是否开机自启 =====
124
- if (askStartup) {
125
- const rl2 = readline.createInterface({
126
- input: process.stdin,
127
- output: process.stdout
128
- });
129
-
130
- rl2.question("是否加入当前用户开机自启?(y/n): ", (answer) => {
131
-
132
- if (answer.toLowerCase() === "y") {
133
- createStartupShortcut(installDir);
134
- } else {
135
- console.log("未启用开机自启");
136
- }
137
-
138
- rl2.close();
139
- });
140
- }
141
-
142
- } catch (e) {
143
- console.error("安装失败:", e.message);
144
- }
145
- }
146
-
147
- // =====================
148
- // 用户交互
149
- // =====================
150
- const rl = readline.createInterface({
151
- input: process.stdin,
152
- output: process.stdout
153
- });
154
-
155
- console.log("========== Filecat 安装程序 ==========");
156
- console.log("默认安装目录:");
157
- console.log(defaultInstallDir);
158
- console.log("");
159
-
160
- rl.question("回车确认安装,或输入自定义安装路径:", (inputPath) => {
161
-
162
- const installDir = inputPath.trim() || defaultInstallDir;
163
-
164
- console.log("");
165
- console.log("安装路径:", installDir);
166
-
167
- rl.question("确认安装?(y/n): ", (confirm) => {
168
-
169
- if (confirm.toLowerCase() !== "y") {
170
- console.log("已取消安装");
171
- rl.close();
172
- return;
173
- }
174
-
175
- rl.close();
176
- install(installDir);
177
- });
178
- });
1
+ const ws = require("windows-shortcuts");
2
+ const path = require("path");
3
+ const fs = require("fs");
4
+ const readline = require("readline");
5
+
6
+ // 当前脚本目录
7
+ const currentDir = __dirname;
8
+
9
+ // 默认安装目录
10
+ const defaultInstallDir = "C:\\Filecat";
11
+
12
+ // 启动脚本
13
+ const CMD_NAME = "filecat-run.cmd";
14
+
15
+ // 开始菜单目录
16
+ const startMenuDir = path.join(
17
+ process.env.APPDATA,
18
+ "Microsoft",
19
+ "Windows",
20
+ "Start Menu",
21
+ "Programs",
22
+ "Filecat"
23
+ );
24
+
25
+ // 当前用户开机启动目录
26
+ const startupDir = path.join(
27
+ process.env.APPDATA,
28
+ "Microsoft",
29
+ "Windows",
30
+ "Start Menu",
31
+ "Programs",
32
+ "Startup"
33
+ );
34
+
35
+ // =====================
36
+ // 递归复制目录
37
+ // =====================
38
+ function copyDir(src, dest) {
39
+ if (!fs.existsSync(dest)) {
40
+ fs.mkdirSync(dest, { recursive: true });
41
+ }
42
+
43
+ const entries = fs.readdirSync(src, { withFileTypes: true });
44
+
45
+ for (let entry of entries) {
46
+ const srcPath = path.join(src, entry.name);
47
+ const destPath = path.join(dest, entry.name);
48
+
49
+ if (entry.isDirectory()) {
50
+ copyDir(srcPath, destPath);
51
+ } else {
52
+ fs.copyFileSync(srcPath, destPath);
53
+ }
54
+ }
55
+ }
56
+
57
+ // =====================
58
+ // 创建开始菜单快捷方式
59
+ // =====================
60
+ function createStartMenuShortcut(installDir) {
61
+ const cmdPath = path.join(installDir, CMD_NAME);
62
+ const shortcutPath = path.join(startMenuDir, "Filecat.lnk");
63
+
64
+ fs.mkdirSync(startMenuDir, { recursive: true });
65
+
66
+ ws.create(shortcutPath, {
67
+ target: cmdPath,
68
+ workingDir: installDir,
69
+ desc: "Filecat 启动程序"
70
+ }, (err) => {
71
+ if (err) {
72
+ console.error("创建开始菜单快捷方式失败:", err);
73
+ } else {
74
+ console.log("开始菜单快捷方式创建成功!");
75
+ }
76
+ });
77
+ }
78
+
79
+ // =====================
80
+ // 创建开机启动快捷方式
81
+ // =====================
82
+ function createStartupShortcut(installDir) {
83
+ const cmdPath = path.join(installDir, CMD_NAME);
84
+ const shortcutPath = path.join(startupDir, "Filecat.lnk");
85
+
86
+ ws.create(shortcutPath, {
87
+ target: cmdPath,
88
+ workingDir: installDir,
89
+ desc: "Filecat 开机自启"
90
+ }, (err) => {
91
+ if (err) {
92
+ console.error("创建开机自启失败:", err);
93
+ } else {
94
+ console.log("已加入当前用户开机自启!");
95
+ }
96
+ });
97
+ }
98
+
99
+ // =====================
100
+ // 安装主流程
101
+ // =====================
102
+ function install(installDir, askStartup = true) {
103
+
104
+ const cmdSrc = path.join(currentDir, CMD_NAME);
105
+
106
+ if (!fs.existsSync(cmdSrc)) {
107
+ console.error("找不到 filecat-run.cmd");
108
+ return;
109
+ }
110
+
111
+ try {
112
+ console.log("正在复制文件...");
113
+
114
+ copyDir(currentDir, installDir);
115
+
116
+ console.log("文件复制完成");
117
+
118
+ createStartMenuShortcut(installDir);
119
+
120
+ console.log("安装成功!");
121
+ console.log("Win 键搜索 Filecat 即可启动");
122
+
123
+ // ===== 询问是否开机自启 =====
124
+ if (askStartup) {
125
+ const rl2 = readline.createInterface({
126
+ input: process.stdin,
127
+ output: process.stdout
128
+ });
129
+
130
+ rl2.question("是否加入当前用户开机自启?(y/n): ", (answer) => {
131
+
132
+ if (answer.toLowerCase() === "y") {
133
+ createStartupShortcut(installDir);
134
+ } else {
135
+ console.log("未启用开机自启");
136
+ }
137
+
138
+ rl2.close();
139
+ });
140
+ }
141
+
142
+ } catch (e) {
143
+ console.error("安装失败:", e.message);
144
+ }
145
+ }
146
+
147
+ // =====================
148
+ // 用户交互
149
+ // =====================
150
+ const rl = readline.createInterface({
151
+ input: process.stdin,
152
+ output: process.stdout
153
+ });
154
+
155
+ console.log("========== Filecat 安装程序 ==========");
156
+ console.log("默认安装目录:");
157
+ console.log(defaultInstallDir);
158
+ console.log("");
159
+
160
+ rl.question("回车确认安装,或输入自定义安装路径:", (inputPath) => {
161
+
162
+ const installDir = inputPath.trim() || defaultInstallDir;
163
+
164
+ console.log("");
165
+ console.log("安装路径:", installDir);
166
+
167
+ rl.question("确认安装?(y/n): ", (confirm) => {
168
+
169
+ if (confirm.toLowerCase() !== "y") {
170
+ console.log("已取消安装");
171
+ rl.close();
172
+ return;
173
+ }
174
+
175
+ rl.close();
176
+ install(installDir);
177
+ });
178
+ });
@@ -1,131 +1,131 @@
1
- const ws = require("windows-shortcuts");
2
- const path = require("path");
3
- const fs = require("fs");
4
-
5
- // =====================
6
- // 开始菜单快捷方式
7
- // =====================
8
- const shortcutPath = path.join(
9
- process.env.APPDATA,
10
- "Microsoft",
11
- "Windows",
12
- "Start Menu",
13
- "Programs",
14
- "Filecat",
15
- "Filecat.lnk"
16
- );
17
-
18
- // =====================
19
- // 开机自启快捷方式
20
- // =====================
21
- const startupShortcutPath = path.join(
22
- process.env.APPDATA,
23
- "Microsoft",
24
- "Windows",
25
- "Start Menu",
26
- "Programs",
27
- "Startup",
28
- "Filecat.lnk"
29
- );
30
-
31
- // =====================
32
- // 安全删除目录
33
- // =====================
34
- function removeDirSafe(dir) {
35
- if (fs.existsSync(dir)) {
36
- fs.rmSync(dir, { recursive: true, force: true });
37
- console.log("已删除目录:", dir);
38
- }
39
- }
40
- function clearDirSafe(dir) {
41
- if (!fs.existsSync(dir)) return;
42
-
43
- const files = fs.readdirSync(dir);
44
-
45
- for (const file of files) {
46
- const fullPath = path.join(dir, file);
47
-
48
- try {
49
- fs.rmSync(fullPath, { recursive: true, force: true });
50
- console.log("已删除:", fullPath);
51
- } catch (e) {
52
- console.error("删除失败:", fullPath, e.message);
53
- }
54
- }
55
- }
56
-
57
- // =====================
58
- // 安全删除文件
59
- // =====================
60
- function removeFileSafe(file) {
61
- if (fs.existsSync(file)) {
62
- fs.rmSync(file, { force: true });
63
- console.log("已删除文件:", file);
64
- }
65
- }
66
-
67
- // =====================
68
- // 删除开机自启
69
- // =====================
70
- function removeStartupShortcut() {
71
- if (fs.existsSync(startupShortcutPath)) {
72
- removeFileSafe(startupShortcutPath);
73
- console.log("已移除开机自启");
74
- }
75
- }
76
-
77
- // =====================
78
- // 主逻辑
79
- // =====================
80
- if (!fs.existsSync(shortcutPath)) {
81
- console.log("找不到开始菜单快捷方式,尝试仅删除开机自启...");
82
-
83
- removeStartupShortcut();
84
-
85
- console.log("卸载完成(仅移除自启)");
86
- process.exit(0);
87
- }
88
-
89
- // 读取快捷方式
90
- ws.query(shortcutPath, (err, options) => {
91
-
92
- if (err) {
93
- console.error("读取快捷方式失败:", err);
94
- process.exit(1);
95
- }
96
-
97
- if (!options.target) {
98
- console.error("快捷方式未包含目标路径");
99
- process.exit(1);
100
- }
101
-
102
- // 获取真实文件路径
103
- const targetFile = options.target;
104
-
105
- // 获取安装目录
106
- const installDir = path.dirname(targetFile);
107
-
108
- console.log("检测到安装目录:", installDir);
109
-
110
- try {
111
-
112
- // 删除安装目录
113
- clearDirSafe(installDir);
114
-
115
- // 删除开始菜单快捷方式
116
- removeFileSafe(shortcutPath);
117
-
118
- // 删除开始菜单文件夹
119
- removeDirSafe(path.dirname(shortcutPath));
120
-
121
- // 删除开机自启
122
- removeStartupShortcut();
123
-
124
- console.log("卸载完成");
125
-
126
- } catch (e) {
127
- console.error("卸载失败:", e.message);
128
- }
129
-
130
- process.exit(0);
131
- });
1
+ const ws = require("windows-shortcuts");
2
+ const path = require("path");
3
+ const fs = require("fs");
4
+
5
+ // =====================
6
+ // 开始菜单快捷方式
7
+ // =====================
8
+ const shortcutPath = path.join(
9
+ process.env.APPDATA,
10
+ "Microsoft",
11
+ "Windows",
12
+ "Start Menu",
13
+ "Programs",
14
+ "Filecat",
15
+ "Filecat.lnk"
16
+ );
17
+
18
+ // =====================
19
+ // 开机自启快捷方式
20
+ // =====================
21
+ const startupShortcutPath = path.join(
22
+ process.env.APPDATA,
23
+ "Microsoft",
24
+ "Windows",
25
+ "Start Menu",
26
+ "Programs",
27
+ "Startup",
28
+ "Filecat.lnk"
29
+ );
30
+
31
+ // =====================
32
+ // 安全删除目录
33
+ // =====================
34
+ function removeDirSafe(dir) {
35
+ if (fs.existsSync(dir)) {
36
+ fs.rmSync(dir, { recursive: true, force: true });
37
+ console.log("已删除目录:", dir);
38
+ }
39
+ }
40
+ function clearDirSafe(dir) {
41
+ if (!fs.existsSync(dir)) return;
42
+
43
+ const files = fs.readdirSync(dir);
44
+
45
+ for (const file of files) {
46
+ const fullPath = path.join(dir, file);
47
+
48
+ try {
49
+ fs.rmSync(fullPath, { recursive: true, force: true });
50
+ console.log("已删除:", fullPath);
51
+ } catch (e) {
52
+ console.error("删除失败:", fullPath, e.message);
53
+ }
54
+ }
55
+ }
56
+
57
+ // =====================
58
+ // 安全删除文件
59
+ // =====================
60
+ function removeFileSafe(file) {
61
+ if (fs.existsSync(file)) {
62
+ fs.rmSync(file, { force: true });
63
+ console.log("已删除文件:", file);
64
+ }
65
+ }
66
+
67
+ // =====================
68
+ // 删除开机自启
69
+ // =====================
70
+ function removeStartupShortcut() {
71
+ if (fs.existsSync(startupShortcutPath)) {
72
+ removeFileSafe(startupShortcutPath);
73
+ console.log("已移除开机自启");
74
+ }
75
+ }
76
+
77
+ // =====================
78
+ // 主逻辑
79
+ // =====================
80
+ if (!fs.existsSync(shortcutPath)) {
81
+ console.log("找不到开始菜单快捷方式,尝试仅删除开机自启...");
82
+
83
+ removeStartupShortcut();
84
+
85
+ console.log("卸载完成(仅移除自启)");
86
+ process.exit(0);
87
+ }
88
+
89
+ // 读取快捷方式
90
+ ws.query(shortcutPath, (err, options) => {
91
+
92
+ if (err) {
93
+ console.error("读取快捷方式失败:", err);
94
+ process.exit(1);
95
+ }
96
+
97
+ if (!options.target) {
98
+ console.error("快捷方式未包含目标路径");
99
+ process.exit(1);
100
+ }
101
+
102
+ // 获取真实文件路径
103
+ const targetFile = options.target;
104
+
105
+ // 获取安装目录
106
+ const installDir = path.dirname(targetFile);
107
+
108
+ console.log("检测到安装目录:", installDir);
109
+
110
+ try {
111
+
112
+ // 删除安装目录
113
+ clearDirSafe(installDir);
114
+
115
+ // 删除开始菜单快捷方式
116
+ removeFileSafe(shortcutPath);
117
+
118
+ // 删除开始菜单文件夹
119
+ removeDirSafe(path.dirname(shortcutPath));
120
+
121
+ // 删除开机自启
122
+ removeStartupShortcut();
123
+
124
+ console.log("卸载完成");
125
+
126
+ } catch (e) {
127
+ console.error("卸载失败:", e.message);
128
+ }
129
+
130
+ process.exit(0);
131
+ });