-
Notifications
You must be signed in to change notification settings - Fork 31
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
fix: use xdg dir as default cli Path #563
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
468e2cc
fix: use xdg dir as default cli Path
ShawkyZ 911d7d1
chore: update axios
ShawkyZ c094338
fix: cli executable tests
ShawkyZ 3b35b74
fix: ensure dir exists
ShawkyZ dbb0860
fix: move existing CLI path to xdg dir
ShawkyZ 583ad61
chore: lint
ShawkyZ fe126ef
chore: lint
ShawkyZ 1359ffc
fix: delete unused import
ShawkyZ 9262328
chore: unused import
ShawkyZ cf59670
chore: lint
ShawkyZ File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { ReplaySubject } from 'rxjs'; | ||
import * as fsPromises from 'fs/promises'; | ||
import { Checksum } from '../../cli/checksum'; | ||
import { messages } from '../../cli/messages/messages'; | ||
import { IConfiguration } from '../configuration/configuration'; | ||
|
@@ -89,10 +90,7 @@ export class DownloadService { | |
} | ||
|
||
async isCliInstalled() { | ||
const cliExecutableExists = await CliExecutable.exists( | ||
this.extensionContext.extensionPath, | ||
await this.configuration.getCliPath(), | ||
); | ||
const cliExecutableExists = await CliExecutable.exists(this.extensionContext.extensionPath); | ||
const cliChecksumWritten = !!this.getCliChecksum(); | ||
|
||
return cliExecutableExists && cliChecksumWritten; | ||
|
@@ -105,11 +103,17 @@ export class DownloadService { | |
return false; | ||
} | ||
const latestChecksum = await this.cliApi.getSha256Checksum(version, platform); | ||
const path = await CliExecutable.getPath( | ||
this.extensionContext.extensionPath, | ||
await this.configuration.getCliPath(), | ||
); | ||
|
||
const path = await this.configuration.getCliPath(); | ||
// migration for moving from default extension path to xdg dirs. | ||
if (CliExecutable.isPathInExtensionDirectory(this.extensionContext.extensionPath, path)) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this might be unnecessary. But I want to ensure extension doesn't break for current preview users. |
||
try { | ||
await fsPromises.unlink(path); | ||
} catch { | ||
// eslint-disable-next-line no-empty | ||
} | ||
await this.configuration.setCliPath(await CliExecutable.getPath()); | ||
return true; | ||
} | ||
// Update is available if fetched checksum not matching the current one | ||
const checksum = await Checksum.getChecksumOf(path, latestChecksum); | ||
if (checksum.verify()) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this was the old logic that ensure cliDir exists.