diff options
author | Armada <jules.blok@gmail.com> | 2013-09-07 01:14:41 +0400 |
---|---|---|
committer | Armada <jules.blok@gmail.com> | 2013-09-07 02:36:53 +0400 |
commit | 0e2bad8e36d1c673cc8e86d97a5228fe4d7cd751 (patch) | |
tree | 233e762d78a8e1560de95cf6fbb13d9572fd9b9d /src | |
parent | aa61bac0108f9a19ed10582a0a3f37477d0e90ad (diff) |
MainFrm: Use GetFileName() when saving subtitles.
Fixes cases where URLs are being used as a suggested subtitle filename.
Diffstat (limited to 'src')
-rw-r--r-- | src/mpc-hc/MainFrm.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mpc-hc/MainFrm.cpp b/src/mpc-hc/MainFrm.cpp index 576bea074..5f428b347 100644 --- a/src/mpc-hc/MainFrm.cpp +++ b/src/mpc-hc/MainFrm.cpp @@ -5329,14 +5329,14 @@ void CMainFrame::OnFileSavesubtitle() return;
}
- OpenMediaData* pOMD = m_wndPlaylistBar.GetCurOMD();
- CString suggestedFileName(_T(""));
- if (OpenFileData* p = dynamic_cast<OpenFileData*>(pOMD)) {
- // HACK: get the file name from the current playlist item
- suggestedFileName = m_wndPlaylistBar.GetCurFileName();
- suggestedFileName = suggestedFileName.Left(suggestedFileName.ReverseFind('.')); // exclude the extension, it will be auto completed
- }
- delete pOMD;
+ CPath suggestedFileName(GetFileName());
+ suggestedFileName.RemoveExtension(); // exclude the extension, it will be auto-completed
+
+ // Try to detect the directory of the current playlist item, and prepend it if it's valid
+ CPath path(m_wndPlaylistBar.GetCurFileName());
+ if (path.RemoveFileSpec() && path.IsDirectory() && path.Append(suggestedFileName)) {
+ suggestedFileName = path;
+ }
if (clsid == __uuidof(CVobSubFile)) {
CVobSubFile* pVSF = (CVobSubFile*)(ISubStream*)pSubInput->subStream;
|