View Issue Details

IDProjectCategoryView StatusLast Update
0002996DarkRadiantGeneralpublic27.08.2013 14:32
Reporterdersaidin Assigned Togreebo  
PrioritynormalSeveritynormalReproducibilityalways
Status closedResolutionfixed 
Target Version1.8.0Fixed in Version1.8.0 
Summary0002996: GameManager adds duplicates VFS search dirs
DescriptionThe game manager is adding duplicate search directories.

I see some logic in Manager::updateEnginePath() to try to avoid duplicate paths, but only in one specific case. Apparently in whatever configuration I have this is not enough to stop duplicates.

Is this a configuration problem? Should we prevent duplicates more thoroughly anyway?
Additional InformationGameManager: Selected game type: XreaL
GameManager: Map path set to C:/weaver2/base/maps/
GameManager: Prefab path set to C:/weaver2/base/prefabs/
VFS Search Path priority is:
- C:/weaver2/base/
- C:/weaver2/base/
=> Module GameManager initialised.
   VirtualFileSystem needs dependency XMLRegistry
ModuleRegistry: dependencies satisfied, invoking initialiser for VirtualFileSystem
VFS::initialiseModule called
filesystem initialised
[vfs] searched directory: C:/weaver2/base/
[vfs] pak file: C:/weaver2/base/textures-trak_2011-01-23.pk3
[vfs] pak file: C:/weaver2/base/models-players-fallen_2010-11-24.pk3
[vfs] pak file: C:/weaver2/base/map-bow_BLOCK-20120124.pk3
[vfs] searched directory: C:/weaver2/base/
[vfs] pak file: C:/weaver2/base/textures-trak_2011-01-23.pk3
[vfs] pak file: C:/weaver2/base/models-players-fallen_2010-11-24.pk3
[vfs] pak file: C:/weaver2/base/map-bow_BLOCK-20120124.pk3
TagsNo tags attached.
Attached Files
darkradiant6981_vfs_pathdup.patch (2,892 bytes)   
Index: radiant/settings/GameManager.cpp
===================================================================
--- radiant/settings/GameManager.cpp	(revision 6981)
+++ radiant/settings/GameManager.cpp	(working copy)
@@ -339,6 +339,18 @@
     );
 }
 
+void Manager::addVFSSearchPath(const std::string &path)
+{
+	// If this path is searched earlier then the file would be found the first time.
+	for (PathList::iterator i = _vfsSearchPaths.begin();
+		i != _vfsSearchPaths.end(); ++i) {
+		if (*i == path) {
+			return;
+		}
+	}
+	_vfsSearchPaths.push_back(path);
+}
+
 bool Manager::settingsValid() const
 {
 	if (os::fileOrDirExists(_enginePath)) {
@@ -436,23 +448,23 @@
 		{
 			if (!_fsGame.empty()) {
 				// We have a MOD, register this directory first
-				_vfsSearchPaths.push_back(_modPath);
+				addVFSSearchPath(_modPath);
 
 #if defined(POSIX)
 				// On Linux, the above was in ~/.doom3/, search the engine mod path as well
 				std::string baseModPath = os::standardPathWithSlash(_enginePath + _fsGame);
-				_vfsSearchPaths.push_back(baseModPath);
+				addVFSSearchPath(baseModPath);
 #endif
 			}
 
 			if (!_fsGameBase.empty()) {
 				// We have a MOD base, register this directory as second
-				_vfsSearchPaths.push_back(_modBasePath);
+				addVFSSearchPath(_modBasePath);
 
 #if defined(POSIX)
 				// On Linux, the above was in ~/.doom3/, search the engine mod path as well
 				std::string baseModPath = os::standardPathWithSlash(_enginePath + _fsGameBase);
-				_vfsSearchPaths.push_back(baseModPath);
+				addVFSSearchPath(baseModPath);
 #endif
 			}
 
@@ -462,20 +474,15 @@
 				getUserEnginePath() + // ~/.doom3
 				currentGame()->getKeyValue("basegame") // base
 			);
-			_vfsSearchPaths.push_back(userBasePath);
+			addVFSSearchPath(userBasePath);
 
 			// Register the base game folder (/usr/local/games/doom3/<basegame>) last
 			// This will always be searched, but *after* the other paths
 			std::string baseGame = os::standardPathWithSlash(
 				_enginePath + currentGame()->getKeyValue("basegame")
 			);
+			addVFSSearchPath(baseGame);
 
-			// greebo: Avoid double-registering the same path (in Windows)
-			if (baseGame != userBasePath)
-			{
-				_vfsSearchPaths.push_back(baseGame);
-			}
-
 			// Update map and prefab paths
 			setMapAndPrefabPaths(userBasePath);
 
Index: radiant/settings/GameManager.h
===================================================================
--- radiant/settings/GameManager.h	(revision 6981)
+++ radiant/settings/GameManager.h	(working copy)
@@ -73,6 +73,11 @@
 	 */
 	void constructPaths();
 
+	/** DerSaidin: Adds a path to the VFS search list, skipping any duplicates.
+	 * 			Note that the order of search paths must be preserved.
+	 */
+	void addVFSSearchPath(const std::string &path);
+
 	/** greebo: Adds the EnginePath and fs_game widgets to the Preference dialog
 	 */
 	void constructPreferences();

Activities

dersaidin

dersaidin

25.01.2012 14:21

reporter   ~0004277

Attached patch fixes issue for me.
greebo

greebo

12.10.2012 19:06

administrator   ~0004912

Thanks, I applied your patch.

Issue History

Date Modified Username Field Change
25.01.2012 14:21 dersaidin New Issue
25.01.2012 14:21 dersaidin File Added: darkradiant6981_vfs_pathdup.patch
25.01.2012 14:21 dersaidin Note Added: 0004277
26.01.2012 13:17 greebo Status new => acknowledged
12.10.2012 19:06 greebo Assigned To => greebo
12.10.2012 19:06 greebo Status acknowledged => assigned
12.10.2012 19:06 greebo Note Added: 0004912
12.10.2012 19:06 greebo Status assigned => resolved
12.10.2012 19:06 greebo Fixed in Version => 1.8.0
12.10.2012 19:06 greebo Resolution open => fixed
12.10.2012 19:07 greebo Target Version => 1.8.0
27.08.2013 14:32 greebo Status resolved => closed