Skip to content

Commit 6d26fef

Browse files
author
John
committed
Fixed directory checks
1 parent 3c6fef0 commit 6d26fef

5 files changed

Lines changed: 11 additions & 24 deletions

File tree

DoomEternal.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ public class DoomEternal
1414
public const int SteamGameID = 782330;
1515
public static string SteamSavePath = Path.Combine(Utilities.GetSteamPath(), "userdata");
1616
public static string BnetSavePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Saved Games", "id Software", "DOOMEternal", "base", "savegame");
17-
public static string BnetSavePathUnencrypted = Path.Combine(BnetSavePath, "savegame.unencrypted", Environment.UserName);
1817

1918
public static DoomEternalSavePathCollection Saves;
2019

DoomEternalSavePath.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ public DoomEternalSavePath(string id, DoomEternalSavePlatform platform, bool enc
4242

4343
public string[] GetRelativePaths() => GetAbsolutePaths().Select(single => single.Replace(FullPath, "").Substring(1)).ToArray();
4444

45+
public bool Exists() => Directory.Exists(FullPath);
46+
4547
public void Zip(string filename) {
4648
using (var fsOut = File.Create(filename))
4749
using (var zs = new ZipOutputStream(fsOut)) {

Form1.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public Form1() {
1414
private void Form1_Load(object sender, EventArgs e) {
1515
DoomEternal.EnumerateSaves();
1616

17-
if(!Directory.Exists(DoomEternal.BnetSavePath) && !Directory.Exists(DoomEternal.BnetSavePathUnencrypted) && !Directory.Exists(DoomEternal.SteamSavePath)) {
17+
if(!Directory.Exists(DoomEternal.BnetSavePath) && !Directory.Exists(DoomEternal.SteamSavePath) && !DoomEternal.Saves.GetSave("savegame.unencrypted").Exists()) {
1818
MessageBox.Show("DOOM Eternal wasn't found on your computer!\r\nThe program will now exit...", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
1919
Application.Exit();
2020
}

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.2")]
36-
[assembly: AssemblyFileVersion("1.3.0.2")]
35+
[assembly: AssemblyVersion("1.3.0.3")]
36+
[assembly: AssemblyFileVersion("1.3.0.3")]

TransferForm.cs

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,28 +40,14 @@ private void transferOkBtn_Click(object sender, EventArgs e) {
4040
return;
4141
}
4242

43-
if(SrcSave.Platform == DoomEternalSavePlatform.BethesdaNet) {
44-
if (!Directory.Exists(Path.Combine(DoomEternal.BnetSavePath, SrcSave.Identifier)) && !Directory.Exists(Path.Combine(DoomEternal.BnetSavePathUnencrypted, SrcSave.Identifier))) {
45-
MessageBox.Show("Source directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
46-
return;
47-
}
48-
} else if(SrcSave.Platform == DoomEternalSavePlatform.Steam) {
49-
if (!Directory.Exists(Utilities.GetSavePathForId64(ulong.Parse(SrcSave.Identifier)))) {
50-
MessageBox.Show("Source directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
51-
return;
52-
}
43+
if (!SrcSave.Exists()) {
44+
MessageBox.Show("Source directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
45+
return;
5346
}
5447

55-
if (DstSave.Platform == DoomEternalSavePlatform.BethesdaNet) {
56-
if (!Directory.Exists(Path.Combine(DoomEternal.BnetSavePath, DstSave.Identifier)) && !Directory.Exists(Path.Combine(DoomEternal.BnetSavePathUnencrypted, DstSave.Identifier))) {
57-
MessageBox.Show("Destination directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
58-
return;
59-
}
60-
} else if (DstSave.Platform == DoomEternalSavePlatform.Steam) {
61-
if (!Directory.Exists(Utilities.GetSavePathForId64(ulong.Parse(DstSave.Identifier)))) {
62-
MessageBox.Show("Destination directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
63-
return;
64-
}
48+
if (!DstSave.Exists()) {
49+
MessageBox.Show("Destination directory doesn't exist!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
50+
return;
6551
}
6652

6753
DialogResult = DialogResult.OK;

0 commit comments

Comments
 (0)