Skip to content

Commit

Permalink
#676 - Extra check
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Oct 6, 2023
1 parent f182403 commit 103c108
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/helpers/SettingsHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,16 @@ export class Settings {
return Settings.globalConfigPath;
}

const configFiles = await workspace.findFiles(`**/${Settings.globalFile}`);
const rootFilePath = join(Folders.getWorkspaceFolder()?.fsPath || '', Settings.globalFile);
if (await existsAsync(rootFilePath)) {
Settings.globalConfigPath = rootFilePath;
return Settings.globalConfigPath;
}

let configFiles = await workspace.findFiles(`**/${Settings.globalFile}`);
// Sort by file path length
configFiles = configFiles.sort((a, b) => a.fsPath.localeCompare(b.fsPath));

if (configFiles.length === 0) {
Settings.globalConfigPath = undefined;
return Settings.globalConfigPath;
Expand Down

0 comments on commit 103c108

Please sign in to comment.