Skip to content

Commit a65ccaf

Browse files
author
John
committed
Added a fix for the null Steam path issue
1 parent cc25706 commit a65ccaf

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

DoomEternal.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public class DoomEternal
1414
public const string GameName = "Doom Eternal";
1515

1616
public const int SteamGameID = 782330;
17-
public static string SteamSavePath = Path.Combine(Utilities.GetSteamPath(), "userdata");
17+
public static string SteamSavePath = "";
1818
public static string BnetSavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Saved Games", "id Software", "DOOMEternal", "base", "savegame");
1919

2020
public static DoomEternalSavePathCollection Saves;
@@ -30,11 +30,15 @@ public static void EnumerateSaves() {
3030
}
3131
}
3232

33-
if (Directory.Exists(SteamSavePath)) {
34-
foreach (var steamId3 in Directory.GetDirectories(SteamSavePath, "*.*", SearchOption.TopDirectoryOnly)) {
35-
foreach (var single in Directory.GetDirectories(steamId3, "*.*", SearchOption.TopDirectoryOnly)) {
36-
if (Path.GetFileNameWithoutExtension(single) == SteamGameID.ToString())
37-
Saves.Add(new DoomEternalSavePath(Utilities.Id3ToId64(Path.GetFileNameWithoutExtension(steamId3)), DoomEternalSavePlatform.Steam));
33+
string steamPath = Utilities.GetSteamPath();
34+
if (!string.IsNullOrEmpty(steamPath)) {
35+
SteamSavePath = Path.Combine(steamPath, "userdata");
36+
if (Directory.Exists(SteamSavePath)) {
37+
foreach (var steamId3 in Directory.GetDirectories(SteamSavePath, "*.*", SearchOption.TopDirectoryOnly)) {
38+
foreach (var single in Directory.GetDirectories(steamId3, "*.*", SearchOption.TopDirectoryOnly)) {
39+
if (Path.GetFileNameWithoutExtension(single) == SteamGameID.ToString())
40+
Saves.Add(new DoomEternalSavePath(Utilities.Id3ToId64(Path.GetFileNameWithoutExtension(steamId3)), DoomEternalSavePlatform.Steam));
41+
}
3842
}
3943
}
4044
}

DoomEternalSavePath.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public DoomEternalSavePath(string id, DoomEternalSavePlatform platform, bool enc
4444

4545
public bool Exists() => Directory.Exists(FullPath);
4646

47-
public void Zip(string filename) {
47+
public void Compress(string filename) {
4848
using (var fsOut = File.Create(filename))
4949
using (var zs = new ZipOutputStream(fsOut)) {
5050
zs.SetLevel(3);
@@ -74,7 +74,7 @@ public void Zip(string filename) {
7474
}
7575
}
7676

77-
public void Extract(string filename) {
77+
public void Decompress(string filename) {
7878
using (Stream fsIn = File.OpenRead(filename))
7979
using (var zf = new ZipFile(fsIn)) {
8080

Form1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private void actionOkBtn_Click(object sender, EventArgs e) {
3232
if (ofd.ShowDialog() == DialogResult.OK) {
3333
var suf = new SelectForm("Select Import Destination");
3434
if (suf.ShowDialog() == DialogResult.OK) {
35-
suf.SelectedSave.Extract(ofd.FileName);
35+
suf.SelectedSave.Decompress(ofd.FileName);
3636
MessageBox.Show("Import success!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
3737
}
3838
}
@@ -49,7 +49,7 @@ private void actionOkBtn_Click(object sender, EventArgs e) {
4949
sfd.FilterIndex = 0;
5050
sfd.FileName = "backup.zip";
5151
if (sfd.ShowDialog() == DialogResult.OK) {
52-
suf.SelectedSave.Zip(sfd.FileName);
52+
suf.SelectedSave.Compress(sfd.FileName);
5353
MessageBox.Show("Export success!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
5454
}
5555
}

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.3.0.4")]
36-
[assembly: AssemblyFileVersion("1.3.0.4")]
35+
[assembly: AssemblyVersion("1.3.0.5")]
36+
[assembly: AssemblyFileVersion("1.3.0.5")]

0 commit comments

Comments
 (0)