本文整理汇总了C++中PHYSFS_addToSearchPath函数的典型用法代码示例。如果您正苦于以下问题:C++ PHYSFS_addToSearchPath函数的具体用法?C++ PHYSFS_addToSearchPath怎么用?C++ PHYSFS_addToSearchPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PHYSFS_addToSearchPath函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PHYSFS_init
ResourceCache::ResourceCache() {
PHYSFS_init(NULL);
PHYSFS_addToSearchPath("data/images.zip", 1);
PHYSFS_addToSearchPath("data/sounds.zip", 1);
al_init_image_addon();
al_init_acodec_addon();
al_set_physfs_file_interface();
}
示例2: PHYSFS_permitSymbolicLinks
void ResourceManager::initialize()
{
PHYSFS_permitSymbolicLinks(1);
const std::string worldDataPath =
Configuration::getValue("worldDataPath", "example");
// world first to allow overriding of server's libraries
PHYSFS_addToSearchPath(worldDataPath.c_str(), 1);
PHYSFS_addToSearchPath(".", 1);
PHYSFS_addToSearchPath(PKG_DATADIR, 1);
}
示例3: main
int main()
{
// Set up the library and paths
PHYSFS_init("blah");
PHYSFS_addToSearchPath("test.zip", 1);
PHYSFS_addToSearchPath("./", 1);
// Create our interface
PhysVFS vfs;
// Run the test
testAll(vfs);
return 0;
}
示例4: mRoot
ZipFileSystem::ZipFileSystem(const String& filePath, const String& root) : mRoot(root){
PHYSFS_init(NULL);
// TODO handle root directory
PHYSFS_addToSearchPath(filePath.c_str(), 0);
}
示例5: Lua_FS_setSearchPath
static int Lua_FS_setSearchPath(lua_State *L) {
const char *str;
char **search_path = PHYSFS_getSearchPath();
char **copy = search_path;
int n, maxn;
luaL_checktype(L, 1, LUA_TTABLE);
/* clear the search path */
while (*copy != NULL) {
PHYSFS_removeFromSearchPath(*copy++);
}
PHYSFS_freeList(search_path);
maxn = lua_objlen(L, 1);
for (n = 1; n <= maxn; n++) {
lua_pushinteger(L, n);
lua_gettable(L, -2);
str = lua_tostring(L, -1);
if (PHYSFS_addToSearchPath(str, 1) == 0) {
return luaL_error(L, "Error: Could not add directory or archive '%s' "
"to search path: %s", str, PHYSFS_getLastError());
}
/* remove the string */
lua_pop(L, 1);
}
return 0;
}
示例6: PrependPath
/**Prepends an archive to be searched for files
* \param ardhivename The path to the archive (can also be a folder)
* \return Nonzero on success */
int Filesystem::PrependPath( const string& archivename ) {
int retval;
if ( (retval = PHYSFS_addToSearchPath(archivename.c_str(), 0)) == 0 )
LogMsg(ERR,"Error on prepends to search path %s.\n%s",archivename.c_str(),
PHYSFS_getLastError());
return retval;
}
示例7: while
void ObjectClass::loadSettings() {
std::stringstream file;
file.str(utils::getTextFile(this->package, "objects/" + this->objectClass + ".txt"));
std::string line;
while (file.good()) {
getline(file, line);
std::string value;
float valueFloat;
if (line.length() == 0 || line.at(0) == '#') {
// Ignore comment lines
} else if (this->parseLine(line, "name", value)) {
this->name = value;
} else if (this->parseLine(line, "flipside", value)) {
if (value.find(".") != std::string::npos) {
std::vector<std::string> path = utils::splitString(value, '.');
PHYSFS_addToSearchPath((path[0] + ".zip").c_str(), 1);
this->flipsideImage = path[0] + "/objects/" + path[1];
} else {
this->flipsideImage = this->package + "/objects/" + value;
}
} else if (this->parseLineFloat(line, "gridwidth", valueFloat)) {
this->gridSize.x = valueFloat;
} else if (this->parseLineFloat(line, "gridheight", valueFloat)) {
this->gridSize.y = valueFloat;
} else if (this->parseLineFloat(line, "scale", valueFloat)) {
this->scale = valueFloat;
} else {
std::cout << "Warning: Could not parse '" << line << "' in " << this->objectClass << ".txt" << std::endl;
}
}
}
示例8: find_datadir
void find_datadir()
{
std::string datadir;
if (m_forced_datadir)
{
datadir = *m_forced_datadir;
}
else if (const char* env_datadir = getenv("SUPERTUX2_DATA_DIR"))
{
datadir = env_datadir;
}
else
{
// check if we run from source dir
char* basepath_c = SDL_GetBasePath();
std::string basepath = basepath_c;
SDL_free(basepath_c);
datadir = FileSystem::join(basepath, "data");
std::string testfname = FileSystem::join(datadir, "credits.txt");
if (!FileSystem::exists(testfname))
{
// if the game is not run from the source directory, try to find
// the global install location
datadir = datadir.substr(0, datadir.rfind(INSTALL_SUBDIR_BIN));
datadir = FileSystem::join(datadir, INSTALL_SUBDIR_SHARE);
}
}
if (!PHYSFS_addToSearchPath(datadir.c_str(), 1))
{
log_warning << "Couldn't add '" << datadir << "' to physfs searchpath: " << PHYSFS_getLastError() << std::endl;
}
}
示例9: addSubdirs
/*!
* Tries to mount a list of directories, found in /basedir/subdir/<list>.
* \param basedir Base directory
* \param subdir A subdirectory of basedir
* \param appendToPath Whether to append or prepend
* \param checkList List of directories to check. NULL means any.
*/
void addSubdirs( const char * basedir, const char * subdir, const bool appendToPath, char * checkList[], bool addToModList )
{
char tmpstr[PATH_MAX];
char buf[256];
char ** subdirlist = PHYSFS_enumerateFiles( subdir );
char ** i = subdirlist;
while( *i != NULL )
{
#ifdef DEBUG
debug( LOG_NEVER, "addSubdirs: Examining subdir: [%s]", *i );
#endif // DEBUG
if (*i[0] != '.' && (!checkList || inList(checkList, *i)))
{
snprintf(tmpstr, sizeof(tmpstr), "%s%s%s%s", basedir, subdir, PHYSFS_getDirSeparator(), *i);
#ifdef DEBUG
debug( LOG_NEVER, "addSubdirs: Adding [%s] to search path", tmpstr );
#endif // DEBUG
if (addToModList)
{
addLoadedMod(*i);
snprintf(buf, sizeof(buf), "mod: %s", *i);
addDumpInfo(buf);
}
PHYSFS_addToSearchPath( tmpstr, appendToPath );
}
i++;
}
PHYSFS_freeList( subdirlist );
}
示例10: addToSearchPath
bool Resources::addToSearchPath(const char* directory, bool append) {
if(!PHYSFS_addToSearchPath(directory, append)) {
PError << "Couldn't add '" << directory << "' to searchpath: " << PHYSFS_getLastError() << endl;
return PFalse;
};
return PTrue;
}
示例11: get_installed_addon
void
AddonManager::enable_addon(const AddonId& addon_id)
{
log_debug << "enabling addon " << addon_id << std::endl;
Addon& addon = get_installed_addon(addon_id);
if (addon.is_enabled())
{
log_warning << "Tried enabling already enabled Add-on" << std::endl;
}
else
{
log_debug << "Adding archive \"" << addon.get_install_filename() << "\" to search path" << std::endl;
//int PHYSFS_mount(addon.installed_install_filename.c_str(), "addons/", 0)
if (PHYSFS_addToSearchPath(addon.get_install_filename().c_str(), 0) == 0)
{
log_warning << "Could not add " << addon.get_install_filename() << " to search path: "
<< PHYSFS_getLastError() << std::endl;
}
else
{
if(addon.get_type() == Addon::LANGUAGEPACK)
{
PHYSFS_enumerateFilesCallback(addon.get_id().c_str(), add_to_dictionary_path, NULL);
}
addon.set_enabled(true);
}
}
}
示例12: PHYSFS_init
//==================================================
//! Constructor
//==================================================
System::VFS::VFS() {
// Initialize PhysicsFS
PHYSFS_init( NULL );
// Hardcoded paths for now
PHYSFS_addToSearchPath( "/Users/aaron/Documents/Phaedrus-FPS/Resources/", 1 );
}
示例13: PHYSFS_init
util::VersionInfo Application::initPhysFS(const std::string& arg0)
{
PHYSFS_Version ver;
PHYSFS_init(arg0.c_str());
PHYSFS_addToSearchPath(PHYSFS_getBaseDir(),0);
PHYSFS_getLinkedVersion(&ver);
return util::VersionInfo(ver.major, ver.minor, ver.patch);
}
示例14: addToSearchPath
bool ResourceManager::addToSearchPath(const std::string& path, bool insertInFront)
{
if(!PHYSFS_addToSearchPath(path.c_str(), insertInFront ? 0 : 1))
return false;
//g_logger.debug(stdext::format("Add search path %s", path));
m_hasSearchPath = true;
return true;
}
示例15: PHYSFS_addToSearchPath
void FileSystem::addToSearchPath(const std::string& dirname, bool append)
{
/// \todo check if dir exists?
/// \todo use PHYSFS_mount? PHYSFS_addToSearchPath is listed as legacy function only there for binary
/// compatibility with older version.
/// \todo check return value
PHYSFS_addToSearchPath(dirname.c_str(), append ? 1 : 0);
}