Throw more useful error if game is in a subdirectory

pull/21/head
Miepee 5 years ago
parent cb158a42a1
commit 0d28d1149f

@ -1118,9 +1118,17 @@ namespace AM2RLauncher
string tmpPath = Path.GetTempPath() + Path.GetFileNameWithoutExtension(zipPath);
// clean up in case folder exists already
if (Directory.Exists(tmpPath))
Directory.Delete(tmpPath, true);
//extract zip to tmp path first
ZipFile.ExtractToDirectory(zipPath, tmpPath);
// If the game is packed into a subfolder, throw error for that
if (Directory.GetDirectories(tmpPath).Length == 1 && new DirectoryInfo(Directory.GetDirectories(tmpPath).First()).Name != "lang")
return IsZipAM2R11ReturnCodes.GameIsInASubfolder;
// check if exe exists
if (!File.Exists(tmpPath + "/AM2R.exe"))
return IsZipAM2R11ReturnCodes.MissingAM2RExe;

@ -56,7 +56,8 @@ namespace AM2RLauncher
Successful,
MissingAM2RExe,
MissingOrInvalidD3DX9_43Dll,
MissingOrInvalidDataWin
MissingOrInvalidDataWin,
GameIsInASubfolder
}
// Splashes

Loading…
Cancel
Save