From 103c10890e00ec60c43ee206ed3d1ca201cf49fe Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Fri, 6 Oct 2023 13:42:24 +0200 Subject: [PATCH] #676 - Extra check --- src/helpers/SettingsHelper.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/helpers/SettingsHelper.ts b/src/helpers/SettingsHelper.ts index c991dea7..04467855 100644 --- a/src/helpers/SettingsHelper.ts +++ b/src/helpers/SettingsHelper.ts @@ -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;