mirror of https://github.com/dotnet/tye.git
committed by
GitHub
6 changed files with 38 additions and 10 deletions
@ -0,0 +1,27 @@ |
|||
// Licensed to the .NET Foundation under one or more agreements.
|
|||
// The .NET Foundation licenses this file to you under the MIT license.
|
|||
// See the LICENSE file in the project root for more information.
|
|||
|
|||
using System.IO; |
|||
|
|||
namespace Microsoft.Tye.ConfigModel |
|||
{ |
|||
internal static class NameInferer |
|||
{ |
|||
public static string? InferApplicationName(FileInfo fileInfo) |
|||
{ |
|||
if (fileInfo == null) |
|||
{ |
|||
return null; |
|||
} |
|||
|
|||
var extension = fileInfo.Extension; |
|||
if (extension == ".sln" || extension == ".csproj" || extension == ".fsproj") |
|||
{ |
|||
return Path.GetFileNameWithoutExtension(fileInfo.Name).ToLowerInvariant(); |
|||
} |
|||
|
|||
return fileInfo.Directory.Parent.Name.ToLowerInvariant(); |
|||
} |
|||
} |
|||
} |
|||
Loading…
Reference in new issue