Skip to content

Commit 580fb1d

Browse files
authored
feat: set default CSV save location to workspace root for remote workspace (#1550)
* chore: Set default CSV save location to workspace root for remote. * chore: Handle remote workspace environments in table download path * DCO Remediation Commit for Shuguang Sun <shuguang79@qq.com> I, Shuguang Sun <shuguang79@qq.com>, hereby add my Signed-off-by to this commit: 75a1541 I, Shuguang Sun <shuguang79@qq.com>, hereby add my Signed-off-by to this commit: 9dd75f2 and alsoe remove unused comments Signed-off-by: Shuguang Sun <shuguang79@qq.com> --------- Signed-off-by: Shuguang Sun <shuguang79@qq.com>
1 parent 0fc9fcd commit 580fb1d

File tree

1 file changed

+18
-3
lines changed
  • client/src/components/LibraryNavigator

1 file changed

+18
-3
lines changed

client/src/components/LibraryNavigator/index.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@ import {
66
ExtensionContext,
77
Uri,
88
commands,
9+
env,
910
window,
1011
workspace,
1112
} from "vscode";
1213

1314
import { createWriteStream } from "fs";
15+
import * as path from "path";
1416

1517
import { profileConfig } from "../../commands/profile";
1618
import { Column } from "../../connection/rest/api/compute";
@@ -69,10 +71,23 @@ class LibraryNavigator implements SubscriptionProvider {
6971
commands.registerCommand(
7072
"SAS.downloadTable",
7173
async (item: LibraryItem) => {
74+
let dataFilePath: string = "";
75+
if (
76+
env.remoteName !== undefined &&
77+
workspace.workspaceFolders &&
78+
workspace.workspaceFolders.length > 0
79+
) {
80+
// start from 'rootPath' workspace folder
81+
dataFilePath = workspace.workspaceFolders[0].uri.fsPath;
82+
}
83+
dataFilePath = path.join(
84+
dataFilePath,
85+
`${item.library}.${item.name}.csv`.toLocaleLowerCase(),
86+
);
87+
88+
// display save file dialog
7289
const uri = await window.showSaveDialog({
73-
defaultUri: Uri.file(
74-
`${item.library}.${item.name}.csv`.toLocaleLowerCase(),
75-
),
90+
defaultUri: Uri.file(dataFilePath),
7691
});
7792

7893
if (!uri) {

0 commit comments

Comments
 (0)