Skip to content

Commit

Permalink
ff
Browse files Browse the repository at this point in the history
  • Loading branch information
aviramha committed Dec 10, 2023
1 parent 5fc924b commit babd92d
Showing 1 changed file with 5 additions and 35 deletions.
40 changes: 5 additions & 35 deletions src/debugger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { globalContext } from './extension';
import { isTargetSet, MirrordConfigManager } from './config';
import { LAST_TARGET_KEY, MirrordAPI, mirrordFailure, MirrordExecution } from './api';
import { updateTelemetries } from './versionCheck';
import { getLocalMirrordBinary, getMirrordBinary } from './binaryManager';
import { getMirrordBinary } from './binaryManager';
import { platform } from 'node:os';
import { NotificationBuilder } from './notification';

Expand Down Expand Up @@ -66,24 +66,6 @@ function changeConfigForSip(config: vscode.DebugConfiguration, executableFieldNa
}



async function getLastActiveMirrordPath(): Promise<string | null> {
const binaryPath = globalContext.globalState.get('binaryPath', null);
if (!binaryPath) {
return null;
}
try {
await vscode.workspace.fs.stat(binaryPath);
return binaryPath;
} catch (e) {
return null;
}
}

function setLastActiveMirrordPath(path: string) {
globalContext.globalState.update('binaryPath', path);
}

/**
* Entrypoint for the vscode extension, called from `resolveDebugConfigurationWithSubstitutedVariables`.
*/
Expand All @@ -110,24 +92,12 @@ async function main(
updateTelemetries();

//TODO: add progress bar maybe ?
let cliPath;
let cliPath = await getMirrordBinary(false);

try {
cliPath = await getMirrordBinary(false);
} catch (err) {
// Get last active, that should work?
cliPath = await getLastActiveMirrordPath();

// Well try any mirrord we can try :\
if (!cliPath) {
cliPath = await getLocalMirrordBinary();
if (!cliPath) {
mirrordFailure(`Couldn't download mirrord binaries or find local one in path ${err}.`);
return null;
}
}
if (!cliPath) {
mirrordFailure(`Couldn't download mirrord binaries or find local one in path`);
return null;
}
setLastActiveMirrordPath(cliPath);

let mirrordApi = new MirrordAPI(cliPath);

Expand Down

0 comments on commit babd92d

Please sign in to comment.