namespace YZWater.Core.Services; /// /// 程序数据文件路径统一入口:一律锚定 exe 所在目录,而不是当前工作目录。 /// /// 之前各处直接写 "yzwater.db"、"projects" 这类相对路径,含义随启动方式漂移: /// 从快捷方式、计划任务或以其它目录为工作目录启动时,程序会在那里另建一个空数据库 /// 和空配置,现场表现为"历史数据突然全空、报警限值回到默认",且原数据看起来像被丢弃。 /// public static class AppPaths { /// 数据文件所在目录(exe 所在目录) public static string Root { get; } = AppContext.BaseDirectory; /// SQLite 数据库文件 public static string Database { get; } = Path.Combine(Root, "yzwater.db"); /// 配置文件 public static string Config { get; } = Path.Combine(Root, "yzwater-config.json"); /// 上一次成功读写过的配置副本,主配置损坏时的回退来源 public static string ConfigLastGood { get; } = Path.Combine(Root, "yzwater-config.json.lastgood"); /// 项目档案目录 public static string Projects { get; } = Path.Combine(Root, "projects"); /// 数据库备份目录 public static string Backups { get; } = Path.Combine(Root, "Backups"); /// 日志目录 public static string Logs { get; } = Path.Combine(Root, "Logs"); }