change-image-suffix 2.1.13 → 2.1.14
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.
- package/CHANGELOG.md +7 -0
- package/dist/index.js +14 -20
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
### [2.1.14](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.13...v2.1.14) (2026-05-25)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* add quotes around %V/%1 in context menu, make resolveSplitPath return string[] ([28ccc83](https://github.com/GuoSirius/change-image-suffix/commit/28ccc83d39f4441eac31a8985509ac49a8ab7019))
|
|
11
|
+
|
|
5
12
|
### [2.1.13](https://github.com/GuoSirius/change-image-suffix/compare/v2.1.12...v2.1.13) (2026-05-25)
|
|
6
13
|
|
|
7
14
|
|
package/dist/index.js
CHANGED
|
@@ -69,9 +69,9 @@ function installContextMenu() {
|
|
|
69
69
|
];
|
|
70
70
|
// ── 使用 ExtendedSubCommandsKey,直接调用 node.exe(无 bat 中转)──
|
|
71
71
|
const menuBases = [
|
|
72
|
-
{ base: 'HKCU\\Software\\Classes\\Directory\\Background\\shell\\cis', subMenu: 'Directory\\ContextMenus\\cis', arg: '-p %V' },
|
|
73
|
-
{ base: 'HKCU\\Software\\Classes\\Directory\\shell\\cis', subMenu: 'Directory\\ContextMenus\\cis_dir', arg: '-p %1' },
|
|
74
|
-
{ base: 'HKCU\\Software\\Classes\\*\\shell\\cis', subMenu: 'Directory\\ContextMenus\\cis_file', arg: '-f %1' },
|
|
72
|
+
{ base: 'HKCU\\Software\\Classes\\Directory\\Background\\shell\\cis', subMenu: 'Directory\\ContextMenus\\cis', arg: '-p "%V"' },
|
|
73
|
+
{ base: 'HKCU\\Software\\Classes\\Directory\\shell\\cis', subMenu: 'Directory\\ContextMenus\\cis_dir', arg: '-p "%1"' },
|
|
74
|
+
{ base: 'HKCU\\Software\\Classes\\*\\shell\\cis', subMenu: 'Directory\\ContextMenus\\cis_file', arg: '-f "%1"' },
|
|
75
75
|
];
|
|
76
76
|
// 1. 注册格式子菜单
|
|
77
77
|
const REG_ROOT = 'HKCU\\Software\\Classes\\';
|
|
@@ -127,13 +127,13 @@ function uninstallContextMenu() {
|
|
|
127
127
|
}
|
|
128
128
|
catch { /* ignore */ }
|
|
129
129
|
}
|
|
130
|
-
//
|
|
130
|
+
// 删除遗留文件(旧版 bat 脚本、图标、版本标记)
|
|
131
131
|
const appDataDir = path.join(os.homedir(), 'AppData', 'Roaming', 'change-image-suffix');
|
|
132
132
|
const batPath = path.join(appDataDir, 'cis_file.bat');
|
|
133
133
|
try {
|
|
134
134
|
fs.unlinkSync(batPath);
|
|
135
135
|
}
|
|
136
|
-
catch { /* ignore */ }
|
|
136
|
+
catch { /* ignore */ } // 旧版残留清理
|
|
137
137
|
const iconPath = path.join(appDataDir, 'icon.ico');
|
|
138
138
|
try {
|
|
139
139
|
fs.unlinkSync(iconPath);
|
|
@@ -183,19 +183,13 @@ function autoUpdateContextMenu() {
|
|
|
183
183
|
// 此函数尝试将拆散的片段拼接回完整路径。
|
|
184
184
|
function resolveSplitPath(parts) {
|
|
185
185
|
if (parts.length === 1)
|
|
186
|
-
return path.resolve(parts[0]);
|
|
187
|
-
//
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
joined += ' ' + parts[j];
|
|
194
|
-
if (fs.existsSync(joined))
|
|
195
|
-
return path.resolve(joined);
|
|
196
|
-
}
|
|
197
|
-
// 都不存在,返回全拼接结果(后续流程会报 "不存在")
|
|
198
|
-
return path.resolve(joined);
|
|
186
|
+
return [path.resolve(parts[0])];
|
|
187
|
+
// 尝试将拆散的片段用空格拼接回完整路径(右键菜单可能将含空格的路径拆成多段)
|
|
188
|
+
const fullJoin = parts.join(' ');
|
|
189
|
+
if (fs.existsSync(fullJoin))
|
|
190
|
+
return [path.resolve(fullJoin)];
|
|
191
|
+
// 无法拼接为单个存在的路径 → 各段视为独立路径(用户主动传了多个路径)
|
|
192
|
+
return parts.map(p => path.resolve(p));
|
|
199
193
|
}
|
|
200
194
|
function parseArgs() {
|
|
201
195
|
const args = process.argv.slice(2);
|
|
@@ -278,7 +272,7 @@ function parseArgs() {
|
|
|
278
272
|
dirsFromFlag.push(path.resolve('.'));
|
|
279
273
|
}
|
|
280
274
|
else {
|
|
281
|
-
dirsFromFlag.push(resolveSplitPath(parts));
|
|
275
|
+
dirsFromFlag.push(...resolveSplitPath(parts));
|
|
282
276
|
}
|
|
283
277
|
i++;
|
|
284
278
|
continue;
|
|
@@ -294,7 +288,7 @@ function parseArgs() {
|
|
|
294
288
|
console.error('❌ -f/--file 需要指定至少一个文件路径');
|
|
295
289
|
process.exit(1);
|
|
296
290
|
}
|
|
297
|
-
filesFromFlag.push(resolveSplitPath(parts));
|
|
291
|
+
filesFromFlag.push(...resolveSplitPath(parts));
|
|
298
292
|
i++;
|
|
299
293
|
continue;
|
|
300
294
|
}
|