Remove recursive look for configurations file

Remove trimming .vshost extension in executable file name
pull/641/head
Buddhika Chathuranga 2020-08-10 13:32:22 +05:30
parent ad2b40df70
commit c4c97f7d34
1 changed files with 9 additions and 22 deletions

View File

@ -664,15 +664,8 @@ namespace WinSW
var executablePath = new DefaultWinSWSettings().ExecutablePath;
var baseName = Path.GetFileNameWithoutExtension(executablePath);
if (baseName.EndsWith(".vshost"))
{
baseName = baseName.Substring(0, baseName.Length - 7);
}
var d = new DirectoryInfo(Path.GetDirectoryName(executablePath));
while (true)
{
if (File.Exists(Path.Combine(d.FullName, baseName + ".xml")))
{
return new ServiceDescriptor(baseName, d);
@ -683,15 +676,9 @@ namespace WinSW
return new ServiceDescriptorYaml(baseName, d).Configurations;
}
if (d.Parent is null)
{
throw new FileNotFoundException($"Unable to locate { baseName }.[xml|yml] file within executable directory or any parents");
}
d = d.Parent;
}
}
private static void PrintHelp()
{
Console.WriteLine("A wrapper binary that can be used to host executables as Windows services");