From 108b90f192c6fe3804245e2c20715a463585beb6 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Wed, 19 Jan 2011 17:54:24 +1300 Subject: [PATCH] Allow the ra/cnc package dir to be overridden at launch-time. --- OpenRA.FileFormats/Filesystem/FileSystem.cs | 7 ++++++- OpenRA.Game/Game.cs | 2 ++ mods/cnc/mod.yaml | 2 +- mods/ra/mod.yaml | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/OpenRA.FileFormats/Filesystem/FileSystem.cs b/OpenRA.FileFormats/Filesystem/FileSystem.cs index 91b7c851f0..1e3b704585 100644 --- a/OpenRA.FileFormats/Filesystem/FileSystem.cs +++ b/OpenRA.FileFormats/Filesystem/FileSystem.cs @@ -19,6 +19,7 @@ namespace OpenRA.FileFormats public static class FileSystem { static List mountedFolders = new List(); + public static string SpecialPackageRoot = ""; static Cache> allFiles = new Cache>( _ => new List() ); @@ -73,7 +74,11 @@ namespace OpenRA.FileFormats { var optional = name.StartsWith("~"); if (optional) name = name.Substring(1); - + + // paths starting with $ are relative to SpecialPackageRoot + if (name.StartsWith("$")) + name = SpecialPackageRoot+name.Substring(1); + var a = (Action)(() => FileSystem.MountInner(OpenPackage(name))); if (optional) diff --git a/OpenRA.Game/Game.cs b/OpenRA.Game/Game.cs index 5ca95f840e..1436dfd7e2 100755 --- a/OpenRA.Game/Game.cs +++ b/OpenRA.Game/Game.cs @@ -219,6 +219,8 @@ namespace OpenRA + Path.DirectorySeparatorChar + "OpenRA"; SupportDir = args.GetValue("SupportDir", defaultSupport); + FileSystem.SpecialPackageRoot = args.GetValue("SpecialPackageRoot", ""); + Settings = new Settings(SupportDir + "settings.yaml", args); Settings.Save(); diff --git a/mods/cnc/mod.yaml b/mods/cnc/mod.yaml index 821aecf062..896315fa36 100644 --- a/mods/cnc/mod.yaml +++ b/mods/cnc/mod.yaml @@ -9,7 +9,7 @@ Folders: mods/cnc mods/cnc/bits mods/cnc/uibits - mods/cnc/packages + $mods/cnc/packages Packages: overrides.mix diff --git a/mods/ra/mod.yaml b/mods/ra/mod.yaml index 53e08f3a4e..848926691d 100644 --- a/mods/ra/mod.yaml +++ b/mods/ra/mod.yaml @@ -10,7 +10,7 @@ Folders: mods/ra mods/ra/bits mods/ra/uibits - mods/ra/packages + $mods/ra/packages Packages: ~main.mix