Command line arguments:

- using "-map" with lower case parameter doesn't crash anymore
 - using "-cfg"/"-config" with a non-existing configuration file doesn't crash anymore
This commit is contained in:
biwa 2022-04-17 18:09:29 +02:00
parent ac57fecf0c
commit ddd68de72e
2 changed files with 12 additions and 6 deletions

View file

@ -831,7 +831,7 @@ namespace CodeImp.DoomBuilder
else if(string.Compare(curarg, "-MAP", true) == 0)
{
// Store next arg as map name information
autoloadmap = argslist.Dequeue();
autoloadmap = argslist.Dequeue()?.ToUpperInvariant();
}
// Config name info?
else if((string.Compare(curarg, "-CFG", true) == 0) ||

View file

@ -546,10 +546,11 @@ namespace CodeImp.DoomBuilder.Windows
if(General.AutoLoadMap != null)
{
Configuration mapsettings;
// Try to find existing options in the settings file
string dbsfile = General.AutoLoadFile.Substring(0, General.AutoLoadFile.Length - 4) + ".dbs";
if(File.Exists(dbsfile))
//string dbsfile = General.AutoLoadFile.Substring(0, General.AutoLoadFile.Length - 4) + ".dbs";
string dbsfile = Path.ChangeExtension(General.AutoLoadFile, "dbs");
if (File.Exists(dbsfile))
try { mapsettings = new Configuration(dbsfile, true); }
catch(Exception) { mapsettings = new Configuration(true); }
else
@ -557,8 +558,13 @@ namespace CodeImp.DoomBuilder.Windows
//mxd. Get proper configuration file
bool longtexturenamessupported = false;
string configfile = General.AutoLoadConfig;
if(string.IsNullOrEmpty(configfile)) configfile = mapsettings.ReadSetting("gameconfig", "");
string configfile = null;
// Make sure the config file exists
if(General.GetConfigurationInfo(General.AutoLoadConfig) != null)
configfile = General.AutoLoadConfig;
if (string.IsNullOrEmpty(configfile)) configfile = mapsettings.ReadSetting("gameconfig", "");
if(configfile.Trim().Length == 0)
{
showdialog = true;