Skip to content

fix: use user-data-dir for storage #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 3, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export class Commands {
if (agents.length === 1) {
folderPath = agents[0].expanded_directory
workspaceAgent = agents[0].name
} else {
} else if (agents.length > 0) {
const agentQuickPick = vscode.window.createQuickPick()
agentQuickPick.title = `Select an agent`

Expand Down
1 change: 1 addition & 0 deletions src/sshSupport.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { sshSupportsSetEnv, sshVersionSupportsSetEnv } from "./sshSupport"

const supports = {
"OpenSSH_8.9p1 Ubuntu-3ubuntu0.1, OpenSSL 3.0.2 15 Mar 2022": true,
"OpenSSH_9.0p1, LibreSSL 3.3.6": true,
"OpenSSH_7.6p1 Ubuntu-4ubuntu0.7, OpenSSL 1.0.2n 7 Dec 2017": false,
"OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017": false,
}
Expand Down
6 changes: 4 additions & 2 deletions src/sshSupport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ export function sshVersionSupportsSetEnv(sshVersionString: string): boolean {
return false
}
// 7.8 is the first version that supports SetEnv
if (Number.parseInt(parts[0], 10) < 7) {
const major = Number.parseInt(parts[0], 10)
const minor = Number.parseInt(parts[1], 10)
if (major < 7) {
return false
}
if (Number.parseInt(parts[1], 10) < 8) {
if (major === 7 && minor < 8) {
return false
}
return true
Expand Down
15 changes: 1 addition & 14 deletions src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ export class Storage {
}

public getUserSettingsPath(): string {
return path.join(this.appDataDir(), "Code", "User", "settings.json")
return path.join(this.globalStorageUri.fsPath, "..", "..", "..", "User", "settings.json")
}

public getSessionTokenPath(): string {
Expand Down Expand Up @@ -292,19 +292,6 @@ export class Storage {
})
}

private appDataDir(): string {
switch (process.platform) {
case "darwin":
return `${os.homedir()}/Library/Application Support`
case "linux":
return `${os.homedir()}/.config`
case "win32":
return process.env.APPDATA || ""
default:
return "/var/local"
}
}

private async updateURL(): Promise<void> {
const url = this.getURL()
axios.defaults.baseURL = url
Expand Down