Skip to content

Commit be06f37

Browse files
authored
Merge pull request #103 from codeurjc-students/directories-unix
parse directories in client from \\ to /
2 parents e129a86 + 4a1bd78 commit be06f37

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

vscode4teaching-extension/src/utils/FileZipUtil.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ export class FileZipUtil {
146146
public static async getZipFromUris(fileUris: vscode.Uri[]) {
147147
const zip = new JSZip();
148148
fileUris.forEach((uri) => {
149-
const uriPath = path.resolve(uri.fsPath);
149+
let uriPath = path.resolve(uri.fsPath)?.replace(/\\/g, '/');
150150
const stat = fs.statSync(uriPath);
151151
if (stat && stat.isDirectory()) {
152152
FileZipUtil.buildZipFromDirectory(uriPath, zip, path.dirname(uriPath));
@@ -169,14 +169,14 @@ export class FileZipUtil {
169169
}
170170
});
171171
for (let file of list) {
172-
file = path.resolve(dir, file);
172+
file = path.resolve(dir, file)?.replace(/\\/g, '/');
173173
if (!ignoredFiles.includes(file)) {
174174
const stat = fs.statSync(file);
175175
if (stat && stat.isDirectory()) {
176176
FileZipUtil.buildZipFromDirectory(file, zip, root, ignoredFiles);
177177
} else {
178178
const filedata = fs.readFileSync(file);
179-
zip.file(path.relative(root, file), filedata);
179+
zip.file(path.relative(root, file)?.replace(/\\/g, '/'), filedata);
180180
}
181181
}
182182

0 commit comments

Comments
 (0)