Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/GCRealTimeMon/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,23 @@ static async Task HandleConsoleInputAsync(IDisposable session, IConsoleOut conso
// Case: Neither -g nor -c was specified => fall back to the Default config.
else
{
// Search if there is a file named .gcmon from the current folder to the root of the current folder volume;
// If not found, use the default configuration.
var currentfolder = new DirectoryInfo(System.Environment.CurrentDirectory);
var root = currentfolder.Root;
var configPath = Path.Combine(currentfolder.FullName, ".gcmon");
bool founded;
while ((founded = File.Exists(configPath)) == false && currentfolder != root)
{
currentfolder = currentfolder.Parent;
configPath = Path.Combine(currentfolder.FullName, ".gcmon");
}
if (founded == false)
{
configPath = defaultPath;
}
// the default .yaml file is at the same location as the CLI global tool / console application
return await ConfigurationReader.ReadConfigurationAsync(defaultPath);
return await ConfigurationReader.ReadConfigurationAsync(configPath);
}
}

Expand Down