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