1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

Tools: Fix packages\lib\fsDriver.test.ts test file on Windows (#10053)

This commit is contained in:
NightKnight 2024-03-05 20:08:47 +02:00 committed by GitHub
parent be2f4d3d79
commit 9a6484c488
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,11 +2,13 @@ import FsDriverNode from './fs-driver-node';
import shim from './shim';
import { expectThrow } from './testing/test-utils';
const windowsPartitionLetter = __filename[0];
// On Windows, path.resolve is going to convert a path such as
// /tmp/file.txt to c:\tmp\file.txt
// /tmp/file.txt to {partition}:\tmp\file.txt
function platformPath(path: string) {
if (shim.isWindows()) {
return `c:${path.replace(/\//g, '\\')}`;
return `${windowsPartitionLetter}:${path.replace(/\//g, '\\')}`;
} else {
return path;
}