Skip to content

Commit 4006a88

Browse files
authored
Don't fail if CMakeLists.txt was appended to sourceDirectory (#1016)
1 parent b1fe911 commit 4006a88

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/drivers/driver.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,10 @@ export abstract class CMakeDriver implements vscode.Disposable {
394394
log.debug('Run _refreshExpansions cb');
395395
const opts = this.expansionOptions;
396396
this._sourceDirectory = util.lightNormalizePath(await expand.expandString(this.config.sourceDirectory, opts));
397+
if (path.basename(this._sourceDirectory).toLocaleLowerCase() === "cmakelists.txt") {
398+
// Don't fail if CMakeLists.txt was accidentally appended to the sourceDirectory.
399+
this._sourceDirectory = path.dirname(this._sourceDirectory);
400+
}
397401
this._binaryDir = util.lightNormalizePath(await expand.expandString(this.config.buildDirectory, opts));
398402

399403
const installPrefix = this.config.installPrefix;

0 commit comments

Comments
 (0)