Save packages to the support dir by default, but continue to support mods/*/packages
This commit is contained in:
@@ -19,7 +19,7 @@ namespace OpenRA.FileFormats
|
||||
public static class FileSystem
|
||||
{
|
||||
static List<IFolder> mountedFolders = new List<IFolder>();
|
||||
public static string SpecialPackageRoot = "";
|
||||
public static string SupportDir = "."; // Default to "current dir" if we aren't told otherwise
|
||||
|
||||
static Cache<uint, List<IFolder>> allFiles = new Cache<uint, List<IFolder>>( _ => new List<IFolder>() );
|
||||
|
||||
@@ -72,12 +72,13 @@ namespace OpenRA.FileFormats
|
||||
|
||||
public static void Mount(string name)
|
||||
{
|
||||
var start = name;
|
||||
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);
|
||||
// paths starting with ^ are relative to the support dir
|
||||
if (name.StartsWith("^"))
|
||||
name = FileSystem.SupportDir+name.Substring(1);
|
||||
|
||||
var a = (Action)(() => FileSystem.MountInner(OpenPackage(name)));
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ namespace OpenRA
|
||||
+ Path.DirectorySeparatorChar + "OpenRA";
|
||||
|
||||
SupportDir = args.GetValue("SupportDir", defaultSupport);
|
||||
FileSystem.SpecialPackageRoot = args.GetValue("SpecialPackageRoot", "");
|
||||
FileSystem.SupportDir = SupportDir;
|
||||
|
||||
Utilities = new Utilities(args.GetValue("UtilityPath", "OpenRA.Utility.exe"));
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
|
||||
if (Info.InstallMode != "ra")
|
||||
ShowDownloadError(window, "Installing from CD not supported");
|
||||
else if (InstallRAPackages(window, path, FileSystem.SpecialPackageRoot+Info.PackagePath))
|
||||
else if (InstallRAPackages(window, path, Info.ResolvedPackagePath))
|
||||
Game.RunAfterTick(ContinueLoading);
|
||||
}
|
||||
|
||||
@@ -130,7 +130,7 @@ namespace OpenRA.Mods.RA.Widgets.Delegates
|
||||
status.GetText = () => "Extracting...";
|
||||
progress.Indeterminate = true;
|
||||
|
||||
if (ExtractZip(window, file, FileSystem.SpecialPackageRoot+Info.PackagePath))
|
||||
if (ExtractZip(window, file, Info.ResolvedPackagePath))
|
||||
Game.RunAfterTick(ContinueLoading);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
using OpenRA.Widgets;
|
||||
using System;
|
||||
using OpenRA.Mods.RA.Widgets.Delegates;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenRA.Mods.RA.Widgets
|
||||
{
|
||||
@@ -21,6 +22,8 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
public string PackageURL = "";
|
||||
public string PackagePath = "";
|
||||
public string InstallMode = "";
|
||||
|
||||
public string ResolvedPackagePath { get { return PackagePath.Replace("^", Game.SupportDir); } }
|
||||
|
||||
public override void DrawInner() {}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ GameInitInfo@INIT_SETUP:
|
||||
TestFile: conquer.mix
|
||||
GameTitle: Command & Conquer
|
||||
PackageURL:http://open-ra.org/get-dependency.php?file=cnc-packages
|
||||
PackagePath:mods/cnc/packages/
|
||||
PackagePath:^/packages/cnc
|
||||
InstallMode:cnc
|
||||
Delegate:GameInitDelegate
|
||||
|
||||
|
||||
@@ -6,10 +6,11 @@ Metadata:
|
||||
Standalone: true
|
||||
Folders:
|
||||
.
|
||||
mods/cnc
|
||||
mods/cnc/bits
|
||||
mods/cnc/uibits
|
||||
$mods/cnc/packages
|
||||
./mods/cnc
|
||||
./mods/cnc/bits
|
||||
./mods/cnc/uibits
|
||||
~./mods/cnc/packages
|
||||
~^/packages/cnc
|
||||
|
||||
Packages:
|
||||
overrides.mix
|
||||
|
||||
@@ -3,7 +3,7 @@ GameInitInfo@INIT_SETUP:
|
||||
TestFile: redalert.mix
|
||||
GameTitle: Red Alert
|
||||
PackageURL:http://open-ra.org/get-dependency.php?file=ra-packages
|
||||
PackagePath:mods/ra/packages/
|
||||
PackagePath:^/packages/ra
|
||||
InstallMode:ra
|
||||
Delegate:GameInitDelegate
|
||||
|
||||
|
||||
@@ -7,10 +7,11 @@ Metadata:
|
||||
|
||||
Folders:
|
||||
.
|
||||
mods/ra
|
||||
mods/ra/bits
|
||||
mods/ra/uibits
|
||||
$mods/ra/packages
|
||||
./mods/ra
|
||||
./mods/ra/bits
|
||||
./mods/ra/uibits
|
||||
~./mods/ra/packages
|
||||
~^/packages/ra
|
||||
|
||||
Packages:
|
||||
~main.mix
|
||||
|
||||
Reference in New Issue
Block a user