Skip to content

Commit

Permalink
fix: fix path
Browse files Browse the repository at this point in the history
  • Loading branch information
Pd233 committed Mar 5, 2024
1 parent e02dc5d commit 65bc1f1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/LipUI/Language/en-US/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
<data name="serverSelection$existed" xml:space="preserve">
<value>Server path already exists!</value>
</data>
<data name="settingsAndAbout$title" xml:space="preserve">
<data name="settingsAndAbout$title.Text" xml:space="preserve">
<value>Settings &amp; About</value>
</data>
<data name="startServer.Text" xml:space="preserve">
Expand Down
2 changes: 1 addition & 1 deletion src/LipUI/Language/zh-CN/Resources.resw
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@
<data name="serverSelection$existed" xml:space="preserve">
<value>服务器路径已存在!</value>
</data>
<data name="settingsAndAbout$title" xml:space="preserve">
<data name="settingsAndAbout$title.Text" xml:space="preserve">
<value>设置 &amp; 关于</value>
</data>
<data name="startServer.Text" xml:space="preserve">
Expand Down
8 changes: 6 additions & 2 deletions src/LipUI/Models/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,12 @@ private set

public static string WorkingDirectory { get; private set; }

public static string ProgramDirectory { get; private set; }

public static bool ColorsFirstInitSign = false;


[MemberNotNull(nameof(Config), nameof(WorkingDirectory))]
[MemberNotNull(nameof(Config), nameof(WorkingDirectory), nameof(ProgramDirectory))]
private static void Initialize()
{
InitializeWorkingDir();
Expand All @@ -43,11 +45,13 @@ private static void Initialize()
Directory.Delete(autoupdateDir);
}

[MemberNotNull(nameof(WorkingDirectory))]
[MemberNotNull(nameof(WorkingDirectory), nameof(ProgramDirectory))]
private static void InitializeWorkingDir()
{
var currentDir = new FileInfo(Environment.ProcessPath!).Directory!.FullName;

ProgramDirectory = currentDir;

var path = Path.Combine(currentDir, DefaultSettings.DataDirectory);
if (Directory.Exists(path) is false)
{
Expand Down
4 changes: 2 additions & 2 deletions src/LipUI/Pages/Settings/SettingsAndAboutView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ await InternalServices.ShowInfoBarAsync(
message: "lipExecution$nullLipPath".GetLocalized());

Process.Start(
Path.Combine(Main.WorkingDirectory, "AutoUpdate.exe"),
@$"--type lipui_autoupdate --lip-path ""{path}"" --working-dir ""{Main.WorkingDirectory}""");
Path.Combine(Main.ProgramDirectory, "AutoUpdate.exe"),
@$"--type lipui_autoupdate --lip-path ""{path}"" --working-dir ""{Main.ProgramDirectory}""");

Environment.Exit(0);
}
Expand Down

0 comments on commit 65bc1f1

Please sign in to comment.