Skip to content

Commit 8086c7b

Browse files
authored
fix: use user-data-dir for storage (#94)
1 parent 4662ebd commit 8086c7b

File tree

4 files changed

+7
-17
lines changed

4 files changed

+7
-17
lines changed

src/commands.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export class Commands {
217217
if (agents.length === 1) {
218218
folderPath = agents[0].expanded_directory
219219
workspaceAgent = agents[0].name
220-
} else {
220+
} else if (agents.length > 0) {
221221
const agentQuickPick = vscode.window.createQuickPick()
222222
agentQuickPick.title = `Select an agent`
223223

src/sshSupport.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { sshSupportsSetEnv, sshVersionSupportsSetEnv } from "./sshSupport"
33

44
const supports = {
55
"OpenSSH_8.9p1 Ubuntu-3ubuntu0.1, OpenSSL 3.0.2 15 Mar 2022": true,
6+
"OpenSSH_9.0p1, LibreSSL 3.3.6": true,
67
"OpenSSH_7.6p1 Ubuntu-4ubuntu0.7, OpenSSL 1.0.2n 7 Dec 2017": false,
78
"OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017": false,
89
}

src/sshSupport.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ export function sshVersionSupportsSetEnv(sshVersionString: string): boolean {
2424
return false
2525
}
2626
// 7.8 is the first version that supports SetEnv
27-
if (Number.parseInt(parts[0], 10) < 7) {
27+
const major = Number.parseInt(parts[0], 10)
28+
const minor = Number.parseInt(parts[1], 10)
29+
if (major < 7) {
2830
return false
2931
}
30-
if (Number.parseInt(parts[1], 10) < 8) {
32+
if (major === 7 && minor < 8) {
3133
return false
3234
}
3335
return true

src/storage.ts

+1-14
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ export class Storage {
264264
}
265265

266266
public getUserSettingsPath(): string {
267-
return path.join(this.appDataDir(), "Code", "User", "settings.json")
267+
return path.join(this.globalStorageUri.fsPath, "..", "..", "..", "User", "settings.json")
268268
}
269269

270270
public getSessionTokenPath(): string {
@@ -292,19 +292,6 @@ export class Storage {
292292
})
293293
}
294294

295-
private appDataDir(): string {
296-
switch (process.platform) {
297-
case "darwin":
298-
return `${os.homedir()}/Library/Application Support`
299-
case "linux":
300-
return `${os.homedir()}/.config`
301-
case "win32":
302-
return process.env.APPDATA || ""
303-
default:
304-
return "/var/local"
305-
}
306-
}
307-
308295
private async updateURL(): Promise<void> {
309296
const url = this.getURL()
310297
axios.defaults.baseURL = url

0 commit comments

Comments
 (0)