@lvce-editor/test-worker 17.0.1 → 17.0.2
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/dist/testWorkerMain.js +12 -1
- package/package.json +1 -1
package/dist/testWorkerMain.js
CHANGED
|
@@ -4037,9 +4037,20 @@ const shouldHaveFile = async (uri, expectedContent) => {
|
|
|
4037
4037
|
const remove = async uri => {
|
|
4038
4038
|
await invoke('FileSystem.remove', uri);
|
|
4039
4039
|
};
|
|
4040
|
+
const windowsPathRegex = /^[A-Za-z]:\//;
|
|
4041
|
+
const toFileUri = path => {
|
|
4042
|
+
if (path.startsWith('file://')) {
|
|
4043
|
+
return path;
|
|
4044
|
+
}
|
|
4045
|
+
const normalizedPath = path.replaceAll('\\', '/');
|
|
4046
|
+
if (windowsPathRegex.test(normalizedPath)) {
|
|
4047
|
+
return `file:///${normalizedPath}`;
|
|
4048
|
+
}
|
|
4049
|
+
return `file://${normalizedPath}`;
|
|
4050
|
+
};
|
|
4040
4051
|
const getTmpDirFileScheme = async () => {
|
|
4041
4052
|
const tmpFolder = await invoke('PlatformPaths.getTmpDir');
|
|
4042
|
-
const tmpUri = tmpFolder
|
|
4053
|
+
const tmpUri = toFileUri(tmpFolder);
|
|
4043
4054
|
const uri = `${tmpUri}/test-${Date.now()}`;
|
|
4044
4055
|
await mkdir(uri);
|
|
4045
4056
|
return uri;
|