Check for a null as well

This will help the description be populated with the correct information if only the name is defined.
This commit is contained in:
Matt Nadareski
2016-05-25 10:26:13 -07:00
parent bf3630bc04
commit d075f2dc80

View File

@@ -217,7 +217,7 @@ namespace SabreTools
// Double check to see what it needs to be named // Double check to see what it needs to be named
_basePath = (_inputs.Count > 0 ? (File.Exists(_inputs[0]) ? _inputs[0] : _inputs[0] + Path.DirectorySeparatorChar) : ""); _basePath = (_inputs.Count > 0 ? (File.Exists(_inputs[0]) ? _inputs[0] : _inputs[0] + Path.DirectorySeparatorChar) : "");
_basePath = (_basePath != "" ? Path.GetFullPath(_basePath) : ""); _basePath = (_basePath != "" ? Path.GetFullPath(_basePath) : "");
if (_datdata.Name == "") if (String.IsNullOrEmpty(_datdata.Name))
{ {
if (_inputs.Count > 1) if (_inputs.Count > 1)
{ {
@@ -232,8 +232,8 @@ namespace SabreTools
_datdata.Name = _basePath.Split(Path.DirectorySeparatorChar).Last(); _datdata.Name = _basePath.Split(Path.DirectorySeparatorChar).Last();
} }
} }
_datdata.Name = (_datdata.Name == "" ? "Default" : _datdata.Name); _datdata.Name = (String.IsNullOrEmpty(_datdata.Name) ? "Default" : _datdata.Name);
_datdata.Description = (_datdata.Description == "" ? _datdata.Name + (_bare ? "" : " (" + _datdata.Date + ")") : _datdata.Description); _datdata.Description = (String.IsNullOrEmpty(_datdata.Description) ? _datdata.Name + (_bare ? "" : " (" + _datdata.Date + ")") : _datdata.Description);
// Create and open the output file for writing // Create and open the output file for writing
FileStream fs = File.Create(Style.CreateOutfileName(Environment.CurrentDirectory, _datdata)); FileStream fs = File.Create(Style.CreateOutfileName(Environment.CurrentDirectory, _datdata));