Tweak default capture save behaviour to 'soft' remember dir. Refs #335

* Rather than exclusively always opening at the default directory, it
  will only do that until a capture has been successfully saved - then
  it will re-use that previous directory. This is only remembered for as
  long as RenderDoc is open, thereafter it will revert back to the dir
  specified in the options.
This commit is contained in:
baldurk
2016-09-14 12:15:11 +02:00
parent 2f8fd706db
commit 7ca1c2237c
+29 -15
View File
@@ -961,20 +961,42 @@ namespace renderdocui.Windows
saveLogToolStripMenuItem.Enabled = false;
}
private string lastSaveCapturePath = "";
public string GetSavePath()
{
try
{
saveDialog.InitialDirectory = m_Core.Config.DefaultCaptureSaveDirectory;
}
catch (Exception)
if(m_Core.Config.DefaultCaptureSaveDirectory != "")
{
try
{
if (lastSaveCapturePath == "")
saveDialog.InitialDirectory = m_Core.Config.DefaultCaptureSaveDirectory;
else
saveDialog.InitialDirectory = lastSaveCapturePath;
}
catch (Exception)
{
}
}
saveDialog.FileName = "";
DialogResult res = saveDialog.ShowDialog();
if (res == DialogResult.OK)
{
try
{
string dir = Path.GetDirectoryName(saveDialog.FileName);
if(Directory.Exists(dir))
lastSaveCapturePath = dir;
}
catch (Exception)
{
}
return saveDialog.FileName;
}
return "";
}
@@ -1566,17 +1588,9 @@ namespace renderdocui.Windows
private bool PromptSaveLog()
{
try
{
saveDialog.InitialDirectory = m_Core.Config.DefaultCaptureSaveDirectory;
}
catch (Exception)
{
}
string saveFilename = GetSavePath();
DialogResult res = saveDialog.ShowDialog();
if (res == DialogResult.OK)
if (saveFilename != "")
{
if (m_Core.IsLogLocal && !File.Exists(m_Core.LogFileName))
{