Basic info command
This commit is contained in:
@@ -5,6 +5,8 @@ public class FolderService : IFolderService
|
||||
public string? ConfigRoot { get; }
|
||||
public string AppData { get; }
|
||||
|
||||
public string ApplicationSubfolderName => "alma";
|
||||
|
||||
public FolderService()
|
||||
{
|
||||
ConfigRoot = GetConfigHomePath();
|
||||
@@ -13,19 +15,22 @@ public class FolderService : IFolderService
|
||||
if (!Directory.Exists(AppData)) Directory.CreateDirectory(AppData);
|
||||
}
|
||||
|
||||
private static string? GetConfigHomePath()
|
||||
public string GetPreferredConfigurationFolder()
|
||||
=> Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config");
|
||||
|
||||
private string? GetConfigHomePath()
|
||||
{
|
||||
var configHomeProviders = new List<Func<string?>>
|
||||
{
|
||||
() => Environment.GetEnvironmentVariable("XDG_CONFIG_HOME"),
|
||||
() => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".config")
|
||||
() => GetPreferredConfigurationFolder()
|
||||
};
|
||||
|
||||
var configHome = EnumerateProviders(configHomeProviders);
|
||||
return configHome == null ? null : Path.Combine(configHome, "alma");
|
||||
return configHome == null ? null : Path.Combine(configHome, ApplicationSubfolderName);
|
||||
}
|
||||
|
||||
private static string GetAppDataPath()
|
||||
private string GetAppDataPath()
|
||||
{
|
||||
var appDataProviders = new List<Func<string?>>
|
||||
{
|
||||
@@ -33,7 +38,7 @@ public class FolderService : IFolderService
|
||||
};
|
||||
|
||||
var appData = EnumerateProviders(appDataProviders) ?? Environment.CurrentDirectory;
|
||||
return Path.Combine(appData, "alma");
|
||||
return Path.Combine(appData, ApplicationSubfolderName);
|
||||
}
|
||||
|
||||
private static string? EnumerateProviders(List<Func<string?>> providers)
|
||||
|
||||
Reference in New Issue
Block a user