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

25 lines
881 B
C#
Raw Normal View History

2020-02-28 12:59:59 +01:00
using System;
using System.IO;
using System.Linq;
2020-03-24 20:53:23 +01:00
namespace UpToolLib.Tool
2020-02-28 12:59:59 +01:00
{
2020-03-24 20:53:23 +01:00
public static class PathTool
2020-02-28 12:59:59 +01:00
{
public static string Dir =>
2020-02-28 14:26:16 +01:00
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "UpTool2");
2020-02-28 12:59:59 +01:00
public static string TempPath => GetRelative("tmp");
public static string AppsPath => GetRelative("Apps");
2020-02-28 14:26:16 +01:00
public static string InfoXml => GetRelative("info.xml");
2020-02-28 12:59:59 +01:00
2020-02-28 14:26:16 +01:00
public static string GetRelative(params string[] segments) =>
Path.Combine(new[] {Dir}.Concat(segments).ToArray());
2020-02-28 12:59:59 +01:00
public static string GetAppPath(Guid app) => Path.Combine(AppsPath, app.ToString());
2020-02-28 12:59:59 +01:00
2020-02-28 14:26:16 +01:00
public static string GetDataPath(Guid app) => Path.Combine(GetAppPath(app), "app");
public static string GetInfoPath(Guid app) => Path.Combine(GetAppPath(app), "info.xml");
2020-02-28 12:59:59 +01:00
}
}