diff --git a/stepmania/src/arch/ArchHooks/ArchHooks_Unix.cpp b/stepmania/src/arch/ArchHooks/ArchHooks_Unix.cpp index c866d9fc2c..59cd4969e5 100644 --- a/stepmania/src/arch/ArchHooks/ArchHooks_Unix.cpp +++ b/stepmania/src/arch/ArchHooks/ArchHooks_Unix.cpp @@ -267,11 +267,35 @@ void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable ) FILEMAN->Mount( "dir", sUserDataPath + "/Save", "/Save" ); FILEMAN->Mount( "dir", sUserDataPath + "/Screenshots", "/Screenshots" ); - /* Search for a directory with "Songs" in it. Be careful: the CWD is likely to - * be ~, and it's possible that some users will have a ~/Songs/ directory that - * has nothing to do with us, so check the initial directory last. */ + /* Search for SMData.smzip in the directory of the executable + * first in case some one has an older version installed in + * the datadir. Then search the datadir. Lastly look for + * Songs, using cwd last. + * XXX: Songs seems like a bad choice. The game will still run + * without Songs and they might have AdditionalSongFolders + * pointing to their songs. Themes seems like the one to look + * for since the game will not run without that. */ RString Root = ""; struct stat st; + if( !access(sDirOfExecutable + "/SMData.smzip", R_OK) ) + { + FILEMAN->Mount( "dir", sDirOfExecutable, "/" ); + FILEMAN->Mount( "zip", "/SMData.smzip", "/" ); + return; + } +#ifdef DATADIR +#define XSTR(x) #x +#define STR(x) XSTR(x) + RString datadir = XSTR(DATADIR) "/" + sProductId; + if( !access(datadir + "/SMData.smzip", R_OK) ) + { + FILEMAN->Mount( "dir", datadir, "/" ); + FILEMAN->Mount( "zip", "/SMData.smzip", "/" ); + return; + } +#undef STR +#undef XSTR +#endif if( Root == "" && !stat( sDirOfExecutable + "/Songs", &st ) && st.st_mode&S_IFDIR ) Root = sDirOfExecutable; if( Root == "" && !stat( RageFileManagerUtil::sInitialWorkingDirectory + "/Songs", &st ) && st.st_mode&S_IFDIR )