Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix: failing tsLink unit test on Windows

Ilian Sapundshiev541cc045a381
diff --git a/src/renderer/utils/tsLink.ts b/src/renderer/utils/tsLink.ts
index 084ba064b..acf1aa511 100644
--- a/src/renderer/utils/tsLink.ts
+++ b/src/renderer/utils/tsLink.ts
@@ -16,8 +16,6 @@
*
*/
-import { joinPaths } from '@tagspaces/tagspaces-common/paths';
-
export type TsLinkKind =
| 'cmd'
| 'ts'
@@ -147,5 +145,9 @@ export function resolveRelativePath(
.split(/[\/\\]/)
.filter((p) => p.length > 0)
.join(sep);
- return joinPaths(sep, baseDir, relPath);
+ if (!relPath) return baseDir;
+ // Don't use joinPaths here: on Windows it strips the leading separator of
+ // the result (e.g. '/home/...' → 'home/...') via its drive-path trim,
+ // which also fires for unix-style paths joined with '/' on win32.
+ return baseDir.endsWith(sep) ? baseDir + relPath : baseDir + sep + relPath;
}