Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Nov 3, 2024
1 parent 0accf26 commit a3e45d2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions v2rayN/ServiceLib/Handler/AutoStartupHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,14 @@ private static string GetAutoRunNameWindows()

private static async Task ClearTaskLinux()
{
File.Delete(GetHomePathLinux());
try
{
File.Delete(GetHomePathLinux());
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
}
}

private static async Task SetTaskLinux()
Expand All @@ -127,8 +134,6 @@ private static async Task SetTaskLinux()
Logging.SaveLog(linuxConfig);

var homePath = GetHomePathLinux();
Directory.CreateDirectory(Path.GetDirectoryName(homePath));

await File.WriteAllTextAsync(homePath, linuxConfig);
}
}
Expand All @@ -140,7 +145,9 @@ private static async Task SetTaskLinux()

private static string GetHomePathLinux()
{
return Path.Combine(Utils.GetHomePath(), ".config", "autostart", $"{Global.AppName}.desktop");
var homePath = Path.Combine(Utils.GetHomePath(), ".config", "autostart", $"{Global.AppName}.desktop");
Directory.CreateDirectory(Path.GetDirectoryName(homePath));
return homePath;
}

#endregion Linux
Expand Down

0 comments on commit a3e45d2

Please sign in to comment.