• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PHYSFS_addToSearchPath函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PHYSFS_addToSearchPath函数的典型用法代码示例。如果您正苦于以下问题:C++ PHYSFS_addToSearchPath函数的具体用法?C++ PHYSFS_addToSearchPath怎么用?C++ PHYSFS_addToSearchPath使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PHYSFS_addToSearchPath函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:chn22,项目名称:OSGCC6,代码行数:8,代码来源:ResourceCache.cpp


示例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);
}
开发者ID:Ablu,项目名称:manaserv,代码行数:12,代码来源:resourcemanager.cpp


示例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;
}
开发者ID:AlfredBroda,项目名称:openmw,代码行数:15,代码来源:physfs_server_test.cpp


示例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);
}
开发者ID:spiricn,项目名称:Wt,代码行数:7,代码来源:ZipFileSystem.cpp


示例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;
}
开发者ID:scriptum,项目名称:Engine,代码行数:29,代码来源:FileIO.c


示例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;
}
开发者ID:markettwp,项目名称:Epiar,代码行数:10,代码来源:filesystem.cpp


示例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;
		}
	}
}
开发者ID:Anakonda,项目名称:opengamebox,代码行数:33,代码来源:objectClass.cpp


示例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;
    }
  }
开发者ID:iOSAppList,项目名称:supertux,代码行数:34,代码来源:main.cpp


示例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 );
}
开发者ID:GhostKing,项目名称:warzone2100,代码行数:36,代码来源:main.cpp


示例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;
}
开发者ID:ezh,项目名称:ENikiBENiki,代码行数:7,代码来源:Resources.cpp


示例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);
    }
  }
}
开发者ID:joewan,项目名称:supertux,代码行数:28,代码来源:addon_manager.cpp


示例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 );
}
开发者ID:schnarf,项目名称:Phaedrus-FPS,代码行数:10,代码来源:VFS.cpp


示例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);
}
开发者ID:jamesturk,项目名称:cpp_photon,代码行数:8,代码来源:Application.cpp


示例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;
}
开发者ID:LeandroPerrotta,项目名称:otclient,代码行数:8,代码来源:resourcemanager.cpp


示例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);
}
开发者ID:EliasOenal,项目名称:blobby,代码行数:8,代码来源:FileSystem.cpp


示例16: strcpy

physfsDrive::physfsDrive(const char * startdir,Bit16u _bytes_sector,Bit8u _sectors_cluster,Bit16u _total_clusters,Bit16u _free_clusters,Bit8u _mediaid)
		   :localDrive(startdir,_bytes_sector,_sectors_cluster,_total_clusters,_free_clusters,_mediaid) {

	char newname[CROSS_LEN+1];

	/* No writedir given, use capture directory */
	if(startdir[0] == ':') {
		strcpy(newname,capturedir.c_str());
		strcat(newname,startdir);
	} else {
		strcpy(newname,startdir);
	}

	CROSS_FILENAME(newname);	
	if (!physfs_used) {
		PHYSFS_init("");
		PHYSFS_permitSymbolicLinks(1);
	}

	physfs_used++;
	char *lastdir = newname;
	char *dir = strchr(lastdir+(((lastdir[0]|0x20) >= 'a' && (lastdir[0]|0x20) <= 'z')?2:0),':');
	while (dir) {
		*dir++ = 0;
		if((lastdir == newname) && !strchr(dir+(((dir[0]|0x20) >= 'a' && (dir[0]|0x20) <= 'z')?2:0),':')) {
			// If the first parameter is a directory, the next one has to be the archive file,
			// do not confuse it with basedir if trailing : is not there!
			int tmp = strlen(dir)-1;
			dir[tmp++] = ':';
			dir[tmp++] = CROSS_FILESPLIT;
			dir[tmp] = '\0';
		}
		if (*lastdir && PHYSFS_addToSearchPath(lastdir,true) == 0) {
			LOG_MSG("PHYSFS couldn't add '%s': %s",lastdir,PHYSFS_getLastError());
		}
		lastdir = dir;
		dir = strchr(lastdir+(((lastdir[0]|0x20) >= 'a' && (lastdir[0]|0x20) <= 'z')?2:0),':');
	}
	const char *oldwrite = PHYSFS_getWriteDir();
	if (oldwrite) oldwrite = strdup(oldwrite);
	if (!PHYSFS_setWriteDir(newname)) {
		if (!oldwrite)
			LOG_MSG("PHYSFS can't use '%s' for writing, you might encounter problems",newname);
		else
			PHYSFS_setWriteDir(oldwrite);
	}
	if (oldwrite) free((char *)oldwrite);
	
	strcpy(basedir,lastdir);

	allocation.bytes_sector=_bytes_sector;
	allocation.sectors_cluster=_sectors_cluster;
	allocation.total_clusters=_total_clusters;
	allocation.free_clusters=_free_clusters;
	allocation.mediaid=_mediaid;

	dirCache.SetBaseDir(basedir, this);
}
开发者ID:Cliff-F,项目名称:Boxer,代码行数:58,代码来源:drive_physfs.cpp


示例17: PHYSFSX_addArchiveContent

/* 
 * Add archives to the game.
 * 1) archives from Sharepath/Data to extend/replace builtin game content
 * 2) archived demos
 */
void PHYSFSX_addArchiveContent()
{
	char **list = NULL;
	static const char *const archive_exts[] = { ".zip", ".7z", NULL };
	char *file[2];
	int i = 0, content_updated = 0;

	con_printf(CON_DEBUG, "PHYSFS: Adding archives to the game.\n");
	// find files in Searchpath ...
	list = PHYSFSX_findFiles("", archive_exts);
	// if found, add them...
	for (i = 0; list[i] != NULL; i++)
	{
		MALLOC(file[0], char, PATH_MAX);
		MALLOC(file[1], char, PATH_MAX);
		snprintf(file[0], sizeof(char)*PATH_MAX, "%s", list[i]);
		PHYSFSX_getRealPath(file[0],file[1]);
		if (PHYSFS_addToSearchPath(file[1], 0))
		{
			con_printf(CON_DEBUG, "PHYSFS: Added %s to Search Path\n",file[1]);
			content_updated = 1;
		}
		d_free(file[0]);
		d_free(file[1]);
	}
	PHYSFS_freeList(list);
	list = NULL;

#if PHYSFS_VER_MAJOR >= 2
	// find files in DEMO_DIR ...
	list = PHYSFSX_findFiles(DEMO_DIR, archive_exts);
	// if found, add them...
	for (i = 0; list[i] != NULL; i++)
	{
		MALLOC(file[0], char, PATH_MAX);
		MALLOC(file[1], char, PATH_MAX);
		snprintf(file[0], sizeof(char)*PATH_MAX, "%s%s", DEMO_DIR, list[i]);
		PHYSFSX_getRealPath(file[0],file[1]);
		if (PHYSFS_mount(file[1], DEMO_DIR, 0))
		{
			con_printf(CON_DEBUG, "PHYSFS: Added %s to %s\n",file[1], DEMO_DIR);
			content_updated = 1;
		}
		d_free(file[0]);
		d_free(file[1]);
	}

	PHYSFS_freeList(list);
	list = NULL;
#endif

	if (content_updated)
	{
		con_printf(CON_DEBUG, "Game content updated!\n");
		PHYSFSX_listSearchPathContent();
	}
}
开发者ID:Pickle,项目名称:dxx-rebirth,代码行数:62,代码来源:physfsx.cpp


示例18: main

int main(int argc, char **argv)
{
	char filename[PATH_MAX];
	char path[PATH_MAX], *delim;
	GAMEMAP *map;

	if (argc != 2)
	{
		printf("Usage: %s <map>\n", argv[0]);
		return -1;
	}
	strcpy(path, argv[1]);
	delim = strrchr(path, '/');
	if (delim)
	{
		*delim = '\0';
		delim++;
		strcpy(filename, delim);
	}
	else
	{
		path[1] = '.';
		path[1] = '\0';
		strcpy(filename, argv[1]);
	}
	PHYSFS_init(argv[0]);
	PHYSFS_addToSearchPath(path, 1);

	map = mapLoad(filename);
	if (map)
	{
		char tilesetName[PATH_MAX];

		if (map->tileset == TILESET_ARIZONA) { strcpy(tilesetName, "Arizona"); }
		else if (map->tileset == TILESET_URBAN) { strcpy(tilesetName, "Urban"); }
		else if (map->tileset == TILESET_ROCKIES) { strcpy(tilesetName, "Rockies"); }
		else { strcpy(tilesetName, "(unknown)"); }

		printf("Loaded map: %s\n", filename);
		printf("\tMap version: %d\n", (int)map->mapVersion);
		printf("\tGame version: %d\n", (int)map->gameVersion);
		printf("\tWidth: %d\n", (int)map->width);
		printf("\tHeight: %d\n", (int)map->height);
		printf("\tGateways: %d\n", (int)map->numGateways);
		printf("\tPlayers: %d\n", (int)map->numPlayers);
		printf("\tFeatures: %d\n", (int)map->numFeatures);
		printf("\tDroids: %d\n", (int)map->numDroids);
		printf("\tStructures: %d\n", (int)map->numStructures);
		printf("\tScroll limits: (%d, %d, %d, %d)\n",
			   (int)map->scrollMinX, (int)map->scrollMinY, (int)map->scrollMaxX, (int)map->scrollMaxY);
		printf("\tLevel name: %s\n", map->levelName);
		printf("\tTileset: %s\n", tilesetName);
	}
	mapFree(map);

	return 0;
}
开发者ID:BG1,项目名称:warzone2100,代码行数:57,代码来源:mapinfo.cpp


示例19: SetUp

 virtual void SetUp(void) {
     glfwInit();
     glfwWindowHint(GLFW_OPENGL_DEBUG_CONTEXT, GL_TRUE);
     window = glfwCreateWindow(TEST_WIDTH, TEST_HEIGHT, "gtest", nullptr, nullptr);
     glfwSetWindowPos(window, 300, 300);
     glfwMakeContextCurrent(window);
     ASSERT_EQ(GLEW_OK, glewInit());
     PHYSFS_init("gtest");
     PHYSFS_addToSearchPath("data", true);
 }
开发者ID:SamNi,项目名称:citydemo,代码行数:10,代码来源:gtest_shadermanager.cpp


示例20: l_filesystem_setSource

static int l_filesystem_setSource(lua_State* state)
{
  const char* p = l_tools_toStringOrError(state, 1);

  int a = PHYSFS_addToSearchPath(p, 1);
  if(!a)
    printf("%s %s \n", "Couldn't set source", p);

  return 1;
}
开发者ID:Murii,项目名称:CLove,代码行数:10,代码来源:filesystem.c



注:本文中的PHYSFS_addToSearchPath函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PHYSFS_close函数代码示例发布时间:2022-05-30
下一篇:
C++ PHYSADDR函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap