Fix weird error message

When creating a new project, we now put up a "save as" dialog.  If
you cancel out of the dialog, and have auto-save enabled, we post a
strange message about being unable to create a file with an empty
filename string.
This commit is contained in:
Andy McFadden committed 2024-08-09 20:26:46 -07:00
1 parent 69d3cd1867
commit 5544014b71
1 file changed
+8 -2
+8 -2
View File
@@ -890,8 +890,13 @@ namespace SourceGen {
"' in favor of '" + pathName + "'");
DiscardRecoveryFile();
}
Debug.WriteLine("Recovery: creating '" + pathName + "'");
PrepareRecoveryFile();
if (!string.IsNullOrEmpty(pathName)) {
Debug.WriteLine("Recovery: creating '" + pathName + "'");
PrepareRecoveryFile();
} else {
// Must be a new project that has never been saved.
Debug.WriteLine("Recovery: project name not set, can't create recovery file");
}
}
mAutoSaveTimer.Start();
}
@@ -911,6 +916,7 @@ namespace SourceGen {
/// </summary>
private void PrepareRecoveryFile() {
Debug.Assert(mRecoveryStream == null);
Debug.Assert(!string.IsNullOrEmpty(mProjectPathName));
Debug.Assert(string.IsNullOrEmpty(mRecoveryPathName));
string pathName = GenerateRecoveryPathName(mProjectPathName);