Skip to content

Commit

Permalink
fix: fiiiix
Browse files Browse the repository at this point in the history
  • Loading branch information
Pd233 committed Mar 5, 2024
1 parent e00c7cc commit 7e9ee94
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 33 deletions.
1 change: 0 additions & 1 deletion src/AutoUpdate/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Microsoft.Extensions.Logging;
using System.CommandLine;
using System.Diagnostics;
using System.Text;

using var factory = LoggerFactory.Create(builder => builder.AddConsole());
var logger = factory.CreateLogger("AutoUpdate");
Expand Down
39 changes: 23 additions & 16 deletions src/LipUI/Models/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,31 @@ private static void Initialize()
InitializeWorkingDir();
InitializeConfig();
InternalServices.WindowClosed += SaveConfig;
AutoUpdate();
//AutoUpdate();
}

private static void AutoUpdate()
{
var autoupdateDir = new DirectoryInfo(Path.Combine(ProgramDirectory, ".autoupdate"));
if (autoupdateDir.Exists is false)
return;

if (autoupdateDir.EnumerateFiles().Count() is 0)
{
autoupdateDir.Delete();
return;
}

Process.Start(Path.Combine(autoupdateDir.FullName, "AutoUpdate.exe"), "--type lip_postinstall");
Environment.Exit(0);
}
//private static void AutoUpdate()
//{
// var autoupdateDir = new DirectoryInfo(Path.Combine(ProgramDirectory, ".autoupdate"));
// if (autoupdateDir.Exists is false)
// return;

// if (autoupdateDir.EnumerateFiles().Count() is 0)
// {
// autoupdateDir.Delete();
// return;
// }

// var process = new Process()
// {
// StartInfo = new(Path.Combine(autoupdateDir.FullName, "AutoUpdate.exe"))
// {
// Arguments = "--type lip_postinstall"
// }
// };
// process.Start();
// Environment.Exit(0);
//}

[MemberNotNull(nameof(WorkingDirectory), nameof(ProgramDirectory))]
private static void InitializeWorkingDir()
Expand Down
14 changes: 10 additions & 4 deletions src/LipUI/Pages/Settings/SettingsAndAboutView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,21 @@ await InternalServices.ShowInfoBarAsync(
return;
}

var args = @$"--type lipui_autoupdate --lip-path ""{path}"" --working-dir ""{Main.ProgramDirectory}""";
var args = "install --yes --force-reinstall --no-dependencies github.com/lippkg/LipUI";

InternalServices.ShowInfoBar(
interval: TimeSpan.FromSeconds(3),
message: $"Running {args}");

Process.Start(
Path.Combine(Main.ProgramDirectory, "AutoUpdate.exe"), args);

var process = new Process()
{
StartInfo = new(path)
{
WorkingDirectory = Main.ProgramDirectory,
Arguments = args,
}
};
process.Start();
Environment.Exit(0);
}
}
Expand Down
16 changes: 4 additions & 12 deletions tooth.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@
"goos": "windows",
"goarch": "amd64",
"asset_url": "https://github.com/lippkg/LipUI/releases/download/v0.4.6/LipUI-win-x64.zip",
"commands": {
"post-install": [
"./LipUI.exe"
]
},
"commands": {},
"files": {
"place": [
{
"src": "lipui/*",
"dest": ".autoupdate"
"dest": "./"
}
]
}
Expand All @@ -33,16 +29,12 @@
"goos": "windows",
"goarch": "arm64",
"asset_url": "https://github.com/lippkg/LipUI/releases/download/v0.4.6/LipUI-win-arm64.zip",
"commands": {
"post-install": [
"./LipUI.exe"
]
},
"commands": {},
"files": {
"place": [
{
"src": "lipui/*",
"dest": ".autoupdate"
"dest": "./"
}
]
}
Expand Down

0 comments on commit 7e9ee94

Please sign in to comment.