Look in the application directory and in DATADIR for SMData.smzip. This way the distributed binary can be run its directory or if compiled from source, the data may be installed and we will look there instead. For development, of course, SMData.smzip should not be installed as we should be using the files in Themes and so forth. One easy way to insure that is to set the prefix somewhere like /tmp when developing so that it will look for /tmp/share/stepmania\ cvs/SMData.smzip, which will not exist.
This commit is contained in:
@@ -267,11 +267,35 @@ void ArchHooks::MountInitialFilesystems( const RString &sDirOfExecutable )
|
|||||||
FILEMAN->Mount( "dir", sUserDataPath + "/Save", "/Save" );
|
FILEMAN->Mount( "dir", sUserDataPath + "/Save", "/Save" );
|
||||||
FILEMAN->Mount( "dir", sUserDataPath + "/Screenshots", "/Screenshots" );
|
FILEMAN->Mount( "dir", sUserDataPath + "/Screenshots", "/Screenshots" );
|
||||||
|
|
||||||
/* Search for a directory with "Songs" in it. Be careful: the CWD is likely to
|
/* Search for SMData.smzip in the directory of the executable
|
||||||
* be ~, and it's possible that some users will have a ~/Songs/ directory that
|
* first in case some one has an older version installed in
|
||||||
* has nothing to do with us, so check the initial directory last. */
|
* 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 = "";
|
RString Root = "";
|
||||||
struct stat st;
|
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 )
|
if( Root == "" && !stat( sDirOfExecutable + "/Songs", &st ) && st.st_mode&S_IFDIR )
|
||||||
Root = sDirOfExecutable;
|
Root = sDirOfExecutable;
|
||||||
if( Root == "" && !stat( RageFileManagerUtil::sInitialWorkingDirectory + "/Songs", &st ) && st.st_mode&S_IFDIR )
|
if( Root == "" && !stat( RageFileManagerUtil::sInitialWorkingDirectory + "/Songs", &st ) && st.st_mode&S_IFDIR )
|
||||||
|
|||||||
Reference in New Issue
Block a user