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.
This commit is contained in:
Karl Blomster 2008-01-10 22:28:47 +00:00
parent c0b9a2a5bd
commit bc1b90a3c3

View file

@ -625,9 +625,22 @@ void VideoContext::SaveSnapshot(bool raw) {
wxString option = Options.AsText(_("Video Screenshot Path")); wxString option = Options.AsText(_("Video Screenshot Path"));
wxFileName videoFile(videoName); wxFileName videoFile(videoName);
wxString basepath; wxString basepath;
// Is it a path specifier and not an actual fixed path?
if (option[0] == _T('?')) { 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); 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/"))); else basepath = DecodeRelativePath(option,StandardPaths::DecodePath(_T("?user/")));
basepath += _T("/") + videoFile.GetName(); basepath += _T("/") + videoFile.GetName();