From a0f33332c915f536b7896e0d65ba23e6ee7b7883 Mon Sep 17 00:00:00 2001 From: Pd233 Date: Tue, 5 Mar 2024 18:47:40 +0800 Subject: [PATCH] fix: v0.4.5 --- src/LipUI/Models/Main.cs | 16 ++++++++++++++-- tooth.json | 20 +++++--------------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/LipUI/Models/Main.cs b/src/LipUI/Models/Main.cs index 66eaefb..61e5516 100644 --- a/src/LipUI/Models/Main.cs +++ b/src/LipUI/Models/Main.cs @@ -2,6 +2,7 @@ using LipUI.Pages.LipExecutionPanel; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Text.Json; @@ -40,9 +41,17 @@ private static void Initialize() InitializeWorkingDir(); InitializeConfig(); InternalServices.WindowClosed += SaveConfig; + AutoUpdate(); + } + + private static void AutoUpdate() + { var autoupdateDir = Path.Combine(WorkingDirectory, ".autoupdate"); - if (Directory.Exists(autoupdateDir)) - Directory.Delete(autoupdateDir); + if (Directory.Exists(autoupdateDir) is false) + return; + + Process.Start(Path.Combine(autoupdateDir, "AutoUpdate.exe"), "--type lip_postinstall"); + Environment.Exit(0); } [MemberNotNull(nameof(WorkingDirectory), nameof(ProgramDirectory))] @@ -95,6 +104,9 @@ private static void InitializeConfig() return (true, Config.GeneralSettings.LipPath); else { + if (Path.GetDirectoryName(Config.GeneralSettings.LipPath) != WorkingDirectory) + return (false, string.Empty); + var dialog = new ContentDialog() { XamlRoot = xamlRoot, diff --git a/tooth.json b/tooth.json index 7b2b20f..b08ccbf 100644 --- a/tooth.json +++ b/tooth.json @@ -1,7 +1,7 @@ { "format_version": 2, "tooth": "github.com/lippkg/LipUI", - "version": "0.4.4", + "version": "0.4.5", "info": { "name": "LipUI", "description": "A GUI client for lip", @@ -14,13 +14,8 @@ { "goos": "windows", "goarch": "amd64", - "asset_url": "https://github.com/lippkg/LipUI/releases/download/v0.4.4/LipUI-win-x64.zip", - "commands": { - "post-install": [ - "echo Copy files", - "IF EXIST .autoupdate/current_lipui_path.txt (.autoupdate/AutoUpdate.exe --type lip_postinstall)" - ] - }, + "asset_url": "https://github.com/lippkg/LipUI/releases/download/v0.4.5/LipUI-win-x64.zip", + "commands": {}, "files": { "place": [ { @@ -33,13 +28,8 @@ { "goos": "windows", "goarch": "arm64", - "asset_url": "https://github.com/lippkg/LipUI/releases/download/v0.4.4/LipUI-win-arm64.zip", - "commands": { - "post-install": [ - "echo Copy files", - "IF EXIST .autoupdate/current_lipui_path.txt (.autoupdate/AutoUpdate.exe --type lip_postinstall)" - ] - }, + "asset_url": "https://github.com/lippkg/LipUI/releases/download/v0.4.5/LipUI-win-arm64.zip", + "commands": {}, "files": { "place": [ {