diff --git a/OpenRA.Game/FileSystem/FileSystem.cs b/OpenRA.Game/FileSystem/FileSystem.cs index 018393a19c..c59371e8c4 100644 --- a/OpenRA.Game/FileSystem/FileSystem.cs +++ b/OpenRA.Game/FileSystem/FileSystem.cs @@ -17,7 +17,15 @@ using OpenRA.Primitives; namespace OpenRA.FileSystem { - public class FileSystem + public interface IReadOnlyFileSystem + { + Stream Open(string filename); + bool TryGetPackageContaining(string path, out IReadOnlyPackage package, out string filename); + bool TryOpen(string filename, out Stream s); + bool Exists(string filename); + } + + public class FileSystem : IReadOnlyFileSystem { public IEnumerable MountedPackages { get { return mountedPackages.Keys; } } readonly Dictionary mountedPackages = new Dictionary(); diff --git a/OpenRA.Game/ModData.cs b/OpenRA.Game/ModData.cs index f4523460b7..a5ff4915c1 100644 --- a/OpenRA.Game/ModData.cs +++ b/OpenRA.Game/ModData.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; +using OpenRA.FileSystem; using OpenRA.Graphics; using OpenRA.Widgets; using FS = OpenRA.FileSystem.FileSystem; @@ -36,6 +37,7 @@ namespace OpenRA readonly Lazy defaultRules; public Ruleset DefaultRules { get { return defaultRules.Value; } } + public IReadOnlyFileSystem DefaultFileSystem { get { return ModFiles; } } public ModData(string mod, bool useLoadScreen = false) {