//-------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------- void setup_init_base_vfs_paths() { //---- tell the vfs to add the basic search paths vfs_set_base_search_paths(); //---- mount all of the default global directories // mount the global basicdat directory t the beginning of the list vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat"), Ego::VfsPath("mp_data"), 1 ); // Create a mount point for the /user/modules directory vfs_add_mount_point( fs_getUserDirectory(), Ego::FsPath("modules"), Ego::VfsPath("mp_modules"), 1 ); // Create a mount point for the /data/modules directory vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("modules"), Ego::VfsPath("mp_modules"), 1 ); // Create a mount point for the /user/players directory vfs_add_mount_point( fs_getUserDirectory(), Ego::FsPath("players"), Ego::VfsPath("mp_players"), 1 ); // Create a mount point for the /data/players directory //vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("players"), Ego::VfsPath("mp_players"), 1 ); //ZF> Let's remove the local players folder since it caused so many problems for people // Create a mount point for the /user/remote directory vfs_add_mount_point( fs_getUserDirectory(), Ego::FsPath("import"), Ego::VfsPath("mp_import"), 1 ); // Create a mount point for the /user/remote directory vfs_add_mount_point( fs_getUserDirectory(), Ego::FsPath("remote"), Ego::VfsPath("mp_remote"), 1 ); }
//-------------------------------------------------------------------------------------------- bool setup_init_module_vfs_paths(const char *mod_path) { const char * path_seperator_1, * path_seperator_2; const char * mod_dir_ptr; STRING mod_dir_string; STRING tmpDir; if ( INVALID_CSTR( mod_path ) ) return false; // revert to the program's basic mount points setup_clear_module_vfs_paths(); path_seperator_1 = strrchr( mod_path, SLASH_CHR ); path_seperator_2 = strrchr( mod_path, NET_SLASH_CHR ); path_seperator_1 = std::max( path_seperator_1, path_seperator_2 ); if ( NULL == path_seperator_1 ) { mod_dir_ptr = mod_path; } else { mod_dir_ptr = path_seperator_1 + 1; } strncpy( mod_dir_string, mod_dir_ptr, SDL_arraysize( mod_dir_string ) ); //==== set the module-dependent mount points //---- add the "/modules/*.mod/objects" directories to mp_objects snprintf( tmpDir, SDL_arraysize( tmpDir ), "modules" SLASH_STR "%s" SLASH_STR "objects", mod_dir_string ); // mount the user's module objects directory at the beginning of the mount point list vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath(tmpDir), Ego::VfsPath("mp_objects"), 1 ); // mount the global module objects directory next in the mount point list vfs_add_mount_point( fs_getUserDirectory(), Ego::FsPath(tmpDir), Ego::VfsPath("mp_objects"), 1 ); //---- add the "/basicdat/globalobjects/*" directories to mp_objects //ZF> TODO: Maybe we should dynamically search for all folders in this directory and add them as valid mount points? vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "items"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "magic"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "magic_item"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "misc"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "monsters"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "players"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "potions"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "unique"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "weapons"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "work_in_progress"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "traps"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "pets"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "scrolls"), Ego::VfsPath("mp_objects"), 1 ); vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalobjects" SLASH_STR "armor"), Ego::VfsPath("mp_objects"), 1 ); //---- add the "/modules/*.mod/gamedat" directory to mp_data snprintf( tmpDir, SDL_arraysize( tmpDir ), "modules" SLASH_STR "%s" SLASH_STR "gamedat", mod_dir_string ); // mount the user's module gamedat directory at the beginning of the mount point list vfs_add_mount_point( fs_getUserDirectory(), Ego::FsPath(tmpDir), Ego::VfsPath("mp_data"), 1 ); // append the global module gamedat directory vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath(tmpDir), Ego::VfsPath("mp_data"), 1 ); // put the global globalparticles data after the module gamedat data vfs_add_mount_point( fs_getDataDirectory(), Ego::FsPath("basicdat" SLASH_STR "globalparticles"), Ego::VfsPath("mp_data"), 1 ); return true; }
//-------------------------------------------------------------------------------------------- bool_t setup_read_vfs() { /// @details BB@> read the setup file // Read the local setup.txt fs_ensureUserFile( "setup.txt", btrue ); snprintf( _config_filename, SDL_arraysize( _config_filename ), "%s" SLASH_STR "setup.txt", fs_getUserDirectory() ); // do NOT force the file to open in a read directory if it doesn't exist. this will cause a failure in // linux if the directory is read-only lConfigSetup = LoadConfigFile( _config_filename, bfalse ); //Did something go wrong? if ( NULL == lConfigSetup ) { log_error( "Could not load setup settings: \"%s\"\n", _config_filename ); return bfalse; } log_info( "Loaded setup file - \"%s\".\n", _config_filename ); return btrue; }