Skip to content

Commit d867e37

Browse files
committed
add versionFilePath function
1 parent b3709fd commit d867e37

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/osinstaller/CxInstaller.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,22 @@ export class CxInstaller {
113113
return this.cliVersion;
114114
}
115115
try {
116-
const versionFilePath = path.join('checkmarx-ast-cli.version');
116+
const versionFilePath = this.getVersionFilePath();
117117
const versionContent = await readFileAsync(versionFilePath);
118118
return versionContent.toString().trim();
119119
} catch (error) {
120120
logger.warn('Error reading AST CLI version: ' + error.message);
121121
return this.cliDefaultVersion;
122122
}
123123
}
124+
125+
private getVersionFilePath(): string {
126+
const dirname = __dirname;
127+
if (dirname === '/') { // This is the root directory
128+
return 'checkmarx-ast-cli.version';
129+
}
130+
return path.join(dirname, 'checkmarx-ast-cli.version');
131+
}
124132

125133
private getCompressFolderName(): string {
126134
return `ast-cli.${this.platform === 'win32' ? 'zip' : 'tar.gz'}`;

0 commit comments

Comments
 (0)