Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions vscode4teaching-extension/src/utils/FileZipUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export class FileZipUtil {
public static async getZipFromUris(fileUris: vscode.Uri[]) {
const zip = new JSZip();
fileUris.forEach((uri) => {
const uriPath = path.resolve(uri.fsPath);
let uriPath = path.resolve(uri.fsPath)?.replace(/\\/g, '/');
const stat = fs.statSync(uriPath);
if (stat && stat.isDirectory()) {
FileZipUtil.buildZipFromDirectory(uriPath, zip, path.dirname(uriPath));
Expand All @@ -169,14 +169,14 @@ export class FileZipUtil {
}
});
for (let file of list) {
file = path.resolve(dir, file);
file = path.resolve(dir, file)?.replace(/\\/g, '/');
if (!ignoredFiles.includes(file)) {
const stat = fs.statSync(file);
if (stat && stat.isDirectory()) {
FileZipUtil.buildZipFromDirectory(file, zip, root, ignoredFiles);
} else {
const filedata = fs.readFileSync(file);
zip.file(path.relative(root, file), filedata);
zip.file(path.relative(root, file)?.replace(/\\/g, '/'), filedata);
}
}

Expand Down