You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
716 B
C#

namespace CommanderApp.Services;
public class PathHelper : IPathHelper
{
public string GetUserHomePath()
{
#if WINDOWS
return Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
#else
return Environment.GetFolderPath(Environment.SpecialFolder.Personal);
#endif
}
public string GetRootPath()
{
#if WINDOWS
return Path.GetPathRoot(Environment.SystemDirectory) ?? "C:\\";
#else
return "/";
#endif
}
public string CombinePaths(params string[] paths) => Path.Combine(paths);
public string GetFileName(string path) => Path.GetFileName(path);
public string GetDirectoryName(string path) => Path.GetDirectoryName(path) ?? string.Empty;
}