From bc1b90a3c32aab5b8735c691042c840dac4fd920 Mon Sep 17 00:00:00 2001 From: Karl Blomster Date: Thu, 10 Jan 2008 22:28:47 +0000 Subject: [PATCH] Fix saving of screenshots when dummy video is used and the screenshot save path is ?video by trying ?script instead and if that isn't defined, save to user's home dir. Fixes mantis issue #442. Originally committed to SVN as r1673. --- aegisub/video_context.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/aegisub/video_context.cpp b/aegisub/video_context.cpp index 10934ce7d..09b3971c9 100644 --- a/aegisub/video_context.cpp +++ b/aegisub/video_context.cpp @@ -625,9 +625,22 @@ void VideoContext::SaveSnapshot(bool raw) { wxString option = Options.AsText(_("Video Screenshot Path")); wxFileName videoFile(videoName); wxString basepath; + // Is it a path specifier and not an actual fixed path? if (option[0] == _T('?')) { + // If dummy video is loaded, we can't save to the video location + if (option.StartsWith(_T("?video")) && (videoName.Find(_T("?dummy")) != wxString::wxNOT_FOUND)) { + // So try the script location instead + option = _T("?script"); + } + // Find out where the ?specifier points to basepath = StandardPaths::DecodePath(option); + // If whereever that is isn't defined, we can't save there + if ((basepath == _T("\\")) || (basepath == _T("/"))) { + // So save to the current user's home dir instead + basepath = wxGetHomeDir(); + } } + // Actual fixed (possibly relative) path, decode it else basepath = DecodeRelativePath(option,StandardPaths::DecodePath(_T("?user/"))); basepath += _T("/") + videoFile.GetName();