From 4c7fcc4e0c7057ce764733655c9d1106b8d6d739 Mon Sep 17 00:00:00 2001 From: "Devin J. Pohly" Date: Sat, 12 Oct 2013 23:50:44 -0400 Subject: [PATCH] Resolve more song assets relative to song Check to see if file exists in relative path before assuming it's absolute. --- src/Song.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Song.cpp b/src/Song.cpp index 989947003e..2e8b5cf3ca 100644 --- a/src/Song.cpp +++ b/src/Song.cpp @@ -1370,16 +1370,20 @@ RString GetSongAssetPath( RString sPath, const RString &sSongPath ) if( sPath == "" ) return RString(); + RString sRelPath = sSongPath + sPath; + if( DoesFileExist(sRelPath) ) + return sRelPath; + /* If there's no path in the file, the file is in the same directory as the * song. (This is the preferred configuration.) */ if( sPath.find('/') == string::npos ) - return sSongPath+sPath; + return sRelPath; // The song contains a path; treat it as relative to the top SM directory. if( sPath.Left(3) == "../" ) { // The path begins with "../". Resolve it wrt. the song directory. - sPath = sSongPath + sPath; + sPath = sRelPath; } CollapsePath( sPath );