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:
parent
be2f4d3d79
commit
9a6484c488
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user