Skip to content

Commit

Permalink
small tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-bsaviano committed Jan 13, 2025
1 parent 0f40012 commit 5ba17a9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/commands/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ export async function importXMLFiles(): Promise<any> {
connectionUri = (
await vscode.window.showWorkspaceFolderPick({
ignoreFocusOut: true,
placeHolder: "Pick the workspace folder to get server connection information from",
placeHolder: "Pick a workspace folder. Server-side folders import from the local file system.",
})
)?.uri;
}
Expand All @@ -773,9 +773,9 @@ export async function importXMLFiles(): Promise<any> {
return;
}
let defaultUri = vscode.workspace.getWorkspaceFolder(connectionUri)?.uri ?? connectionUri;
if (defaultUri.scheme != "file") {
// Need a default URI with file scheme or the open dialog
// will show the virtual files from the workspace folder
if (defaultUri.scheme == FILESYSTEM_SCHEMA) {
// Need a default URI without the isfs scheme or the open dialog
// will show the server-side files instead of local ones
defaultUri = vscode.workspace.workspaceFile;
if (defaultUri.scheme != "file") {
vscode.window.showErrorMessage(
Expand Down
10 changes: 7 additions & 3 deletions src/commands/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export async function exportDocumentsToXMLFile(): Promise<void> {
connectionUri = (
await vscode.window.showWorkspaceFolderPick({
ignoreFocusOut: true,
placeHolder: "Pick the workspace folder to get server connection information from",
placeHolder: "Pick a workspace folder. Server-side folders export to the local file system.",
})
)?.uri;
}
Expand All @@ -335,8 +335,8 @@ export async function exportDocumentsToXMLFile(): Promise<void> {
return;
}
let defaultUri = vscode.workspace.getWorkspaceFolder(connectionUri)?.uri ?? connectionUri;
if (defaultUri.scheme != "file") {
// Need a default URI with file scheme or the save dialog
if (schemas.includes(defaultUri.scheme)) {
// Need a default URI without the isfs scheme or the save dialog
// will show the virtual files from the workspace folder
defaultUri = vscode.workspace.workspaceFile;
if (defaultUri.scheme != "file") {
Expand All @@ -349,6 +349,10 @@ export async function exportDocumentsToXMLFile(): Promise<void> {
// Remove the file name from the URI
defaultUri = defaultUri.with({ path: defaultUri.path.split("/").slice(0, -1).join("/") });
}
if (!vscode.workspace.fs.isWritableFileSystem(defaultUri.scheme)) {
vscode.window.showErrorMessage(`Cannot export to read-only file system '${defaultUri.scheme}'.`, "Dismiss");
return;
}
// Prompt the user for the documents to export
const documents = await pickDocuments(api, "to export");
if (documents.length == 0) {
Expand Down

0 comments on commit 5ba17a9

Please sign in to comment.