Skip to content

Commit

Permalink
Check path for binary first (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
infiniteregrets authored Nov 21, 2023
1 parent e2de5d3 commit 46f24e4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 17 deletions.
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

0 comments on commit 46f24e4

Please sign in to comment.