This repository has been archived on 2022-08-05. You can view files and clone it, but cannot push or open issues or pull requests.
UpTool2/UpToolLib/Tool/PathTool.cs
2020-04-08 16:05:09 +02:00

25 lines
881 B
C#

using System;
using System.IO;
using System.Linq;
namespace UpToolLib.Tool
{
public static class PathTool
{
public static string Dir =>
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "UpTool2");
public static string TempPath => GetRelative("tmp");
public static string AppsPath => GetRelative("Apps");
public static string InfoXml => GetRelative("info.xml");
public static string GetRelative(params string[] segments) =>
Path.Combine(new[] {Dir}.Concat(segments).ToArray());
public static string GetAppPath(Guid app) => Path.Combine(AppsPath, app.ToString());
public static string GetDataPath(Guid app) => Path.Combine(GetAppPath(app), "app");
public static string GetInfoPath(Guid app) => Path.Combine(GetAppPath(app), "info.xml");
}
}