mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-13 05:20:45 +00:00
Keep temporary log around to be able to save multiple times. Closes #130
* Previously if a temporary log was saved once, it would be moved there, so the user could in theory delete it and lose the only copy of the log. * Now the temporary log is held until it's closed in the UI, to be able to be saved again. If the user saves the log though, this will stop any "unsaved log" prompts in the main UI window, so there is nothing stopping the user from saving the log, deleting that copy, then closing and they'll lose the log without prompt.
This commit is contained in:
@@ -386,13 +386,11 @@ namespace renderdocui.Windows
|
||||
|
||||
string path = m_Main.GetSavePath();
|
||||
|
||||
// we copy the temp log to the desired path, but the log item remains referring to the temp path.
|
||||
// This ensures that if the user deletes the saved path we can still open or re-save it.
|
||||
if (path.Length > 0)
|
||||
{
|
||||
File.Copy(log.localpath, path, true);
|
||||
File.Delete(log.localpath);
|
||||
|
||||
log.localpath = path;
|
||||
log.saved = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -829,6 +829,7 @@ namespace renderdocui.Windows
|
||||
}
|
||||
|
||||
public bool OwnTemporaryLog = false;
|
||||
private bool SavedTemporaryLog = false;
|
||||
|
||||
public void ShowLiveCapture(LiveCapture live)
|
||||
{
|
||||
@@ -1041,7 +1042,11 @@ namespace renderdocui.Windows
|
||||
{
|
||||
string temppath = m_Core.LogFileName;
|
||||
|
||||
DialogResult res = MessageBox.Show("Save this logfile?", "Unsaved log", MessageBoxButtons.YesNoCancel);
|
||||
DialogResult res = DialogResult.No;
|
||||
|
||||
// unless we've saved the log, prompt to save
|
||||
if(!SavedTemporaryLog)
|
||||
res = MessageBox.Show("Save this logfile?", "Unsaved log", MessageBoxButtons.YesNoCancel);
|
||||
|
||||
if (res == DialogResult.Cancel)
|
||||
{
|
||||
@@ -1061,6 +1066,7 @@ namespace renderdocui.Windows
|
||||
if (temppath != m_Core.LogFileName || res == DialogResult.No)
|
||||
deletepath = temppath;
|
||||
OwnTemporaryLog = false;
|
||||
SavedTemporaryLog = false;
|
||||
}
|
||||
|
||||
CloseLogfile();
|
||||
@@ -1084,17 +1090,13 @@ namespace renderdocui.Windows
|
||||
return false;
|
||||
}
|
||||
|
||||
// we copy the (possibly) temp log to the desired path, but the log item remains referring to the original path.
|
||||
// This ensures that if the user deletes the saved path we can still open or re-save it.
|
||||
File.Copy(m_Core.LogFileName, saveDialog.FileName, true);
|
||||
|
||||
OwnTemporaryLog = false;
|
||||
|
||||
m_Core.LogFileName = saveDialog.FileName;
|
||||
|
||||
SetTitle();
|
||||
|
||||
m_Core.Config.AddRecentFile(m_Core.Config.RecentLogFiles, m_Core.LogFileName, 10);
|
||||
|
||||
PopulateRecentFiles();
|
||||
// we don't prompt to save on closing - if the user deleted the log that we just saved, then
|
||||
// that is up to them.
|
||||
SavedTemporaryLog = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user