Skip to content

Commit 584bd61

Browse files
committed
fix: Fix the environment file read failure issue on the Linux system
1 parent 6c550c1 commit 584bd61

File tree

2 files changed

+6
-9
lines changed

2 files changed

+6
-9
lines changed

src/c#/GeneralUpdate.ClientCore/Strategys/LinuxStrategy.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using GeneralUpdate.ClientCore.Pipeline;
66
using GeneralUpdate.Common.FileBasic;
77
using GeneralUpdate.Common.Internal;
8+
using GeneralUpdate.Common.Internal.Bootstrap;
89
using GeneralUpdate.Common.Internal.Event;
910
using GeneralUpdate.Common.Internal.Pipeline;
1011
using GeneralUpdate.Common.Internal.Strategy;
@@ -21,7 +22,6 @@ namespace GeneralUpdate.ClientCore.Strategys;
2122
public class LinuxStrategy : AbstractStrategy
2223
{
2324
private GlobalConfigInfo _configinfo = new();
24-
private const string ProcessInfoFileName = "ProcessInfo.json";
2525

2626
public override void Create(GlobalConfigInfo parameter) => _configinfo = parameter;
2727

@@ -97,17 +97,15 @@ public override void StartApp()
9797
{
9898
try
9999
{
100+
Environments.SetEnvironmentVariable("ProcessInfo", _configinfo.ProcessInfo);
100101
var appPath = Path.Combine(_configinfo.InstallPath, _configinfo.AppName);
101102
if (File.Exists(appPath))
102103
{
103-
if (File.Exists(ProcessInfoFileName))
104+
Process.Start(new ProcessStartInfo
104105
{
105-
File.SetAttributes(ProcessInfoFileName, FileAttributes.Normal);
106-
File.Delete(ProcessInfoFileName);
107-
}
108-
109-
File.WriteAllText(ProcessInfoFileName, _configinfo.ProcessInfo);
110-
Process.Start(appPath);
106+
UseShellExecute = true,
107+
FileName = appPath
108+
});
111109
}
112110
}
113111
catch (Exception e)

src/c#/GeneralUpdate.ClientCore/Strategys/WindowsStrategy.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ public override void StartApp()
9797
var appPath = Path.Combine(_configinfo.InstallPath, _configinfo.AppName);
9898
if (File.Exists(appPath))
9999
{
100-
Environments.SetEnvironmentVariable("ProcessInfo", _configinfo.ProcessInfo);
101100
Process.Start(new ProcessStartInfo
102101
{
103102
UseShellExecute = true,

0 commit comments

Comments
 (0)