Skip to content

Commit 98ece10

Browse files
committed
Include library assets in networked files
Creates an aggregate filesystem for game files and library files and uses that Signed-off-by: Gio <me@gio.blue>
1 parent bcb38b1 commit 98ece10

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

engine/Sandbox.GameInstance/GameInstanceDll.Network.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,19 @@ void BuildNetworkedFiles()
310310
_netIncludePaths.AddRange( resourcePaths );
311311
}
312312

313-
var fs = gameInstance.GameFileSystem;
313+
// we have the include paths, let's create an aggregate filesystem for our game & libraries
314+
var fs = new AggregateFileSystem();
315+
fs.Mount( gameInstance.GameFileSystem );
316+
317+
// mount all referenced libraries
318+
foreach ( string packageIdent in gameInstance.Package.EnumeratePackageReferences() )
319+
{
320+
if ( PackageManager.Find( packageIdent ) is not { } activePackage )
321+
continue;
322+
323+
fs.Mount( activePackage.FileSystem );
324+
}
325+
314326
var files = fs.FindFile( "/", "*", true );
315327

316328
foreach ( var file in files )

0 commit comments

Comments
 (0)