From: <man...@us...> - 2013-11-15 15:59:00
|
Revision: 3228 http://sourceforge.net/p/modplug/code/3228 Author: manxorist Date: 2013-11-15 15:58:53 +0000 (Fri, 15 Nov 2013) Log Message: ----------- [Fix] RelativePathToAbsolute and AbsolutePathToRelative return the modified path for mpt::PathString instead of modifying the parameter in-place to allow usage in function arguments. This hab been overlooked in a few places during the mpt::PathString conversion. Assign the return value in all cases. [Ref] Remove non-mpt::PathString variants. These are unused by now. Modified Paths: -------------- trunk/OpenMPT/mptrack/Mptrack.cpp trunk/OpenMPT/mptrack/Mptrack.h trunk/OpenMPT/soundlib/plugins/PluginManager.cpp Modified: trunk/OpenMPT/mptrack/Mptrack.cpp =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.cpp 2013-11-15 14:10:44 UTC (rev 3227) +++ trunk/OpenMPT/mptrack/Mptrack.cpp 2013-11-15 15:58:53 UTC (rev 3228) @@ -425,7 +425,7 @@ if(!szFileName.empty()) { if(theApp.IsPortableMode()) - theApp.AbsolutePathToRelative(szFileName); + szFileName = theApp.AbsolutePathToRelative(szFileName); file.Write<mpt::PathString>("Midi Library", s, szFileName); } } @@ -1948,7 +1948,7 @@ mpt::PathString plugPath = theApp.GetSettings().Read<mpt::PathString>("VST Plugins", tmp, MPT_PATHSTRING("")); if(!plugPath.empty()) { - RelativePathToAbsolute(plugPath); + plugPath = RelativePathToAbsolute(plugPath); if(plugPath == failedPlugin) { @@ -1989,7 +1989,7 @@ mpt::PathString plugPath = pPlug->dllPath; if(theApp.IsPortableMode()) { - AbsolutePathToRelative(plugPath); + plugPath = AbsolutePathToRelative(plugPath); } theApp.GetSettings().Write<mpt::PathString>("VST Plugins", tmp, plugPath); plug++; @@ -2071,23 +2071,7 @@ return result; } -template <size_t nLength> -void CTrackApp::AbsolutePathToRelative(TCHAR (&szPath)[nLength]) -//--------------------------------------------------------------- -{ - STATIC_ASSERT(nLength >= 3); - if(_tcslen(szPath) == 0) - return; - mpt::String::Copy(szPath, AbsolutePathToRelative(mpt::PathString::ToCString(szPath)).ToCString()); -} -CString CTrackApp::AbsolutePathToRelative(const CString &path) -//------------------------------------------------------------ -{ - return AbsolutePathToRelative(mpt::PathString::FromCString(path)).ToCString(); -} - - // Convert a relative path to an absolute path. // Paths are relative to the executable path. mpt::PathString CTrackApp::RelativePathToAbsolute(const mpt::PathString &path) @@ -2113,23 +2097,6 @@ return result; } -template <size_t nLength> -void CTrackApp::RelativePathToAbsolute(TCHAR (&szPath)[nLength]) -//--------------------------------------------------------------- -{ - STATIC_ASSERT(nLength >= 3); - if(_tcslen(szPath) == 0) - return; - mpt::String::Copy(szPath, RelativePathToAbsolute(mpt::PathString::ToCString(szPath)).ToCString()); -} - -CString CTrackApp::RelativePathToAbsolute(const CString &path) -//------------------------------------------------------------ -{ - return RelativePathToAbsolute(mpt::PathString::FromCString(path)).ToCString(); -} - - void CTrackApp::RemoveMruItem(const int nItem) //-------------------------------------------- { Modified: trunk/OpenMPT/mptrack/Mptrack.h =================================================================== --- trunk/OpenMPT/mptrack/Mptrack.h 2013-11-15 14:10:44 UTC (rev 3227) +++ trunk/OpenMPT/mptrack/Mptrack.h 2013-11-15 15:58:53 UTC (rev 3228) @@ -207,12 +207,6 @@ // Relative / absolute paths conversion mpt::PathString AbsolutePathToRelative(const mpt::PathString &path); mpt::PathString RelativePathToAbsolute(const mpt::PathString &path); - template <size_t nLength> - MPT_DEPRECATED_PATH void AbsolutePathToRelative(TCHAR (&szPath)[nLength]); - MPT_DEPRECATED_PATH CString AbsolutePathToRelative(const CString &path); - template <size_t nLength> - MPT_DEPRECATED_PATH void RelativePathToAbsolute(TCHAR (&szPath)[nLength]); - MPT_DEPRECATED_PATH CString RelativePathToAbsolute(const CString &path); /// Removes item from MRU-list; most recent item has index zero. void RemoveMruItem(const int nItem); Modified: trunk/OpenMPT/soundlib/plugins/PluginManager.cpp =================================================================== --- trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2013-11-15 14:10:44 UTC (rev 3227) +++ trunk/OpenMPT/soundlib/plugins/PluginManager.cpp 2013-11-15 15:58:53 UTC (rev 3228) @@ -400,7 +400,7 @@ mpt::PathString writePath = dllPath; if(theApp.IsPortableMode()) { - theApp.AbsolutePathToRelative(writePath); + writePath = theApp.AbsolutePathToRelative(writePath); } cacheFile.Write<mpt::PathString>(cacheSection, IDs, writePath); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |