Skip to content

Commit 01b2ea1

Browse files
committed
fix: save file path incorrect on windows
Switch to URI.fsPath instead of URI.path
1 parent 48f0565 commit 01b2ea1

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

lana/src/commands/LogView.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,16 @@ export class LogView {
9696
if (request.text && request.options?.defaultUri) {
9797
const defaultWorkspace = (workspace.workspaceFolders || [])[0];
9898
const defaultDir = defaultWorkspace?.uri.path || homedir();
99-
vscWindow
100-
.showSaveDialog({
101-
defaultUri: Uri.file(join(defaultDir, request.options.defaultUri)),
102-
})
103-
.then((fileInfos) => {
104-
if (fileInfos && request.text) {
105-
writeFile(fileInfos.path, request.text).catch((error) => {
106-
const msg = error instanceof Error ? error.message : String(error);
107-
vscWindow.showErrorMessage(`Unable to save file: ${msg}`);
108-
});
109-
}
99+
const destinationFile = await vscWindow.showSaveDialog({
100+
defaultUri: Uri.file(join(defaultDir, request.options.defaultUri)),
101+
});
102+
103+
if (destinationFile) {
104+
writeFile(destinationFile.fsPath, request.text).catch((error) => {
105+
const msg = error instanceof Error ? error.message : String(error);
106+
vscWindow.showErrorMessage(`Unable to save file: ${msg}`);
110107
});
108+
}
111109
}
112110
break;
113111
}

0 commit comments

Comments
 (0)