Skip to content

Commit

Permalink
Don't compare missing version
Browse files Browse the repository at this point in the history
  • Loading branch information
jiribenes committed Aug 27, 2024
1 parent 18f509c commit a390c14
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/effektManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ interface InstallationResult {
success: boolean;
executable?: string;
message: string;
version?: string | null;
version?: string;
}

interface EffektExecutableInfo {
path: string;
version: string | null;
version: string;
}

/**
Expand Down Expand Up @@ -47,16 +47,12 @@ export class EffektManager {
*
* @returns a version number like '0.2.2' or '0.25.2.13' or '0.99.99+nightly.rev.abcdef', etc.
*/
private async fetchEffektVersion(path: string): Promise<string | null> {
private async fetchEffektVersion(path: string): Promise<string> {
/// Helper function to remove a generic prefix from a string
const removePrefix = (value: string, prefix: string) =>
value.startsWith(prefix) ? value.slice(prefix.length) : value;

const versionOutput = await this.execCommand(`"${path}" --version`);
if (versionOutput.trim() === '') {
return null;
}

// TODO: Handle outputs that don't start with the correct prefix?
const version = removePrefix(versionOutput.trim(), "Effekt "); // NOTE: the space is important here
return version;
Expand Down

0 comments on commit a390c14

Please sign in to comment.