Skip to content

Commit

Permalink
(hopefully) Fix updater crash if Configs folder doesn't exist in old …
Browse files Browse the repository at this point in the history
…version once and for all

This also fixes potential issues with the Updater trying to access System32 folders (due to the way that Windows resolves relative paths)

Fixes #64
  • Loading branch information
Sparronator9999 committed Feb 21, 2025
1 parent 1a032a8 commit 51bc21e
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion YAMDCC.Updater/GitHubApi/ApiError.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace YAMDCC.Updater.GitHubApi;
// suppress warning about default values never getting overwritten
// since they get populated when deserialising JSON to these classes
#pragma warning disable CS0649
internal class ApiError
internal sealed class ApiError
{
[JsonProperty("message")]
public string Message;
Expand Down
2 changes: 1 addition & 1 deletion YAMDCC.Updater/GitHubApi/Author.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace YAMDCC.Updater.GitHubApi;
// suppress warning about default values never getting overwritten
// since they get populated when deserialising JSON to these classes
#pragma warning disable CS0649
internal class Author
internal sealed class Author
{
[JsonProperty("login")]
public string Login;
Expand Down
2 changes: 1 addition & 1 deletion YAMDCC.Updater/GitHubApi/Release.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace YAMDCC.Updater.GitHubApi;
// suppress warning about default values never getting overwritten
// since they get populated when deserialising JSON to these classes
#pragma warning disable CS0649
internal class Release
internal sealed class Release
{
[JsonProperty("url")]
public string Url;
Expand Down
2 changes: 1 addition & 1 deletion YAMDCC.Updater/GitHubApi/ReleaseAsset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace YAMDCC.Updater.GitHubApi;
// suppress warning about default values never getting overwritten
// since they get populated when deserialising JSON to these classes
#pragma warning disable CS0649
internal class ReleaseAsset
internal sealed class ReleaseAsset
{
[JsonProperty("url")]
public string Url;
Expand Down
1 change: 1 addition & 0 deletions YAMDCC.Updater/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ private static void InstallUpdate(
{
// copy new configs individually since we can't
// merge directories without extra work
Directory.CreateDirectory(confPath);
foreach (FileInfo fi in dir.GetFiles())
{
fi.MoveTo(Path.Combine(confPath, fi.Name));
Expand Down
8 changes: 4 additions & 4 deletions YAMDCC.Updater/UpdateForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ internal sealed partial class UpdateForm : Form

private static readonly string ExeName = Path.GetFileName(Assembly.GetEntryAssembly().Location);
private static readonly string TargetPath = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
private static readonly string DownloadPath = Path.GetFullPath("YAMDCC-Update.zip");
private static readonly string UpdatePath = Path.GetFullPath("Update");
private static readonly string OldPath = Path.GetFullPath("Old");
private static readonly string ConfPath = Path.GetFullPath("Configs");
private static readonly string DownloadPath = Path.GetFullPath(@".\YAMDCC-Update.zip");
private static readonly string UpdatePath = Path.GetFullPath(@".\Update");
private static readonly string OldPath = Path.GetFullPath(@".\Old");
private static readonly string ConfPath = Path.GetFullPath(@".\Configs");

public UpdateForm(Release release = null, bool autoUpdate = false)
{
Expand Down

0 comments on commit 51bc21e

Please sign in to comment.