diff --git a/OpenRA.FileFormats/Filesystem/FileSystem.cs b/OpenRA.FileFormats/Filesystem/FileSystem.cs index c2e1004c45..9581d988e5 100644 --- a/OpenRA.FileFormats/Filesystem/FileSystem.cs +++ b/OpenRA.FileFormats/Filesystem/FileSystem.cs @@ -18,7 +18,7 @@ namespace OpenRA.FileFormats { public static class FileSystem { - static List MountedFolders = new List(); + public static List MountedFolders = new List(); static Cache> allFiles = new Cache>( _ => new List() ); @@ -80,10 +80,8 @@ namespace OpenRA.FileFormats if (name.StartsWith("^")) name = Platform.SupportDir+name.Substring(1); - if (Directory.Exists(name)) - FolderPaths.Add(name); - - var a = (Action)(() => FileSystem.MountInner(OpenPackage(name))); + FolderPaths.Add(name); + Action a = () => FileSystem.MountInner(OpenPackage(name)); if (optional) try { a(); } diff --git a/OpenRA.FileFormats/Filesystem/Folder.cs b/OpenRA.FileFormats/Filesystem/Folder.cs index 63773ca599..def3f6863c 100644 --- a/OpenRA.FileFormats/Filesystem/Folder.cs +++ b/OpenRA.FileFormats/Filesystem/Folder.cs @@ -17,8 +17,7 @@ namespace OpenRA.FileFormats public class Folder : IFolder { readonly string path; - - int priority; + readonly int priority; // Create a new folder package public Folder(string path, int priority, Dictionary contents) @@ -65,11 +64,8 @@ namespace OpenRA.FileFormats return File.Exists(Path.Combine(path, filename)); } - - public int Priority - { - get { return priority; } - } + public int Priority { get { return priority; } } + public string Name { get { return path; } } public void Write(Dictionary contents) { diff --git a/OpenRA.FileFormats/Filesystem/InstallShieldPackage.cs b/OpenRA.FileFormats/Filesystem/InstallShieldPackage.cs index d4a444250e..bae6ef1474 100644 --- a/OpenRA.FileFormats/Filesystem/InstallShieldPackage.cs +++ b/OpenRA.FileFormats/Filesystem/InstallShieldPackage.cs @@ -21,10 +21,12 @@ namespace OpenRA.FileFormats readonly List filenames; readonly Stream s; readonly long dataStart = 255; - int priority; + readonly int priority; + readonly string filename; public InstallShieldPackage(string filename, int priority) { + this.filename = filename; this.priority = priority; filenames = new List(); s = FileSystem.Open(filename); @@ -120,11 +122,8 @@ namespace OpenRA.FileFormats return index.ContainsKey(PackageEntry.HashFilename(filename)); } - - public int Priority - { - get { return 2000 + priority; } - } + public int Priority { get { return 2000 + priority; }} + public string Name { get { return filename; } } public void Write(Dictionary contents) { diff --git a/OpenRA.FileFormats/Filesystem/MixFile.cs b/OpenRA.FileFormats/Filesystem/MixFile.cs index 9e2e64e578..55b0d87265 100644 --- a/OpenRA.FileFormats/Filesystem/MixFile.cs +++ b/OpenRA.FileFormats/Filesystem/MixFile.cs @@ -24,6 +24,7 @@ namespace OpenRA.FileFormats IEnumerable AllFileNames(); void Write(Dictionary contents); int Priority { get; } + string Name { get; } } public class MixFile : IFolder @@ -31,11 +32,13 @@ namespace OpenRA.FileFormats readonly Dictionary index; readonly long dataStart; readonly Stream s; - int priority; + readonly int priority; + readonly string filename; // Save a mix to disk with the given contents public MixFile(string filename, int priority, Dictionary contents) { + this.filename = filename; this.priority = priority; if (File.Exists(filename)) File.Delete(filename); @@ -48,6 +51,7 @@ namespace OpenRA.FileFormats public MixFile(string filename, int priority) { + this.filename = filename; this.priority = priority; s = FileSystem.Open(filename); @@ -226,11 +230,9 @@ namespace OpenRA.FileFormats return FindMatchingHash(filename).HasValue; } - public int Priority - { - get { return 1000 + priority; } - } - + public int Priority { get { return 1000 + priority; } } + public string Name { get { return filename; } } + public void Write(Dictionary contents) { // Cannot modify existing mixfile - rename existing file and diff --git a/OpenRA.FileFormats/Filesystem/ZipFile.cs b/OpenRA.FileFormats/Filesystem/ZipFile.cs index 91e8b44984..d1e45eaeaa 100644 --- a/OpenRA.FileFormats/Filesystem/ZipFile.cs +++ b/OpenRA.FileFormats/Filesystem/ZipFile.cs @@ -81,10 +81,8 @@ namespace OpenRA.FileFormats return pkg.GetEntry(filename) != null; } - public int Priority - { - get { return 500 + priority; } - } + public int Priority { get { return 500 + priority; } } + public string Name { get { return filename; } } public void Write(Dictionary contents) {