Skip to content
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

Check path for binary first #84

Merged
merged 1 commit into from
Nov 21, 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 changelog.d/62.added.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Add option to disable auto-update
Add option to disable auto-update.
31 changes: 15 additions & 16 deletions src/binaryManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,6 @@ function getExtensionMirrordPath(): Uri {
* @returns Path to mirrord binary or null if not found
*/
export async function getLocalMirrordBinary(version?: string): Promise<string | null> {
try {
const mirrordPath = getExtensionMirrordPath();
await workspace.fs.stat(mirrordPath);
if (version) {
const api = new MirrordAPI(mirrordPath.fsPath);
const installedVersion = await api.getBinaryVersion();
if (installedVersion === version) {
return mirrordPath.fsPath;
}
} else {
return mirrordPath.fsPath;
}

} catch (e) {
console.log("couldn't find mirrord in extension storage");
}
try {
const mirrordPath = await which("mirrord");
if (version) {
Expand All @@ -59,6 +43,21 @@ export async function getLocalMirrordBinary(version?: string): Promise<string |
} catch (e) {
console.debug("couldn't find mirrord in path");
}
try {
const mirrordPath = getExtensionMirrordPath();
await workspace.fs.stat(mirrordPath);
if (version) {
const api = new MirrordAPI(mirrordPath.fsPath);
const installedVersion = await api.getBinaryVersion();
if (installedVersion === version) {
return mirrordPath.fsPath;
}
} else {
return mirrordPath.fsPath;
}
} catch (e) {
console.log("couldn't find mirrord in extension storage");
}
return null;
}

Expand Down