@wu529778790/open-im 0.2.10 → 0.2.12
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.
|
@@ -159,14 +159,20 @@ export class SessionManager {
|
|
|
159
159
|
const drivePathMatch = targetDir.match(/^([a-zA-Z]):(.*)$/);
|
|
160
160
|
if (drivePathMatch) {
|
|
161
161
|
const [, drive, rest] = drivePathMatch;
|
|
162
|
-
//
|
|
163
|
-
// 如果 rest
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
// 使用 resolve 确保路径格式正确
|
|
163
|
+
// 如果 rest 为空,则是驱动器根目录
|
|
164
|
+
// 如果 rest 不为空,resolve 会正确处理斜杠
|
|
165
|
+
const driveRoot = `${drive}:`;
|
|
166
|
+
if (rest === '') {
|
|
167
|
+
resolved = driveRoot;
|
|
168
|
+
}
|
|
169
|
+
else if (rest.startsWith('/') || rest.startsWith('\\')) {
|
|
170
|
+
// 已是绝对路径,直接使用
|
|
171
|
+
resolved = `${drive}${rest}`;
|
|
166
172
|
}
|
|
167
173
|
else {
|
|
168
|
-
//
|
|
169
|
-
resolved =
|
|
174
|
+
// 相对于驱动器根目录的路径,使用 resolve 处理
|
|
175
|
+
resolved = resolve(driveRoot, rest);
|
|
170
176
|
}
|
|
171
177
|
}
|
|
172
178
|
else if (targetDir === '~' || targetDir.startsWith('~/')) {
|
|
@@ -175,7 +181,7 @@ export class SessionManager {
|
|
|
175
181
|
resolved = join(home, targetDir.slice(1));
|
|
176
182
|
}
|
|
177
183
|
else if (targetDir.startsWith('/') || (targetDir.length >= 3 && targetDir[1] === ':' && (targetDir[2] === '\\' || targetDir[2] === '/'))) {
|
|
178
|
-
//
|
|
184
|
+
// 绝对路径(包括 Windows 绝对路径)
|
|
179
185
|
resolved = targetDir;
|
|
180
186
|
}
|
|
181
187
|
else {
|