Load assets using absolute paths. Fixes #6717.

This commit is contained in:
Paul Chote
2014-10-09 08:36:24 +13:00
parent 0d0b8c1e22
commit 4f44cc1969
35 changed files with 491 additions and 458 deletions

View File

@@ -67,7 +67,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
sourceDropdown.OnMouseDown = _ => ShowSourceDropdown(sourceDropdown);
sourceDropdown.GetText = () =>
{
var name = assetSource != null ? assetSource.Name.Replace(Platform.SupportDir, "^") : "All Packages";
var name = assetSource != null ? Platform.UnresolvePath(assetSource.Name) : "All Packages";
if (name.Length > 15)
name = "..." + name.Substring(name.Length - 15);
@@ -324,7 +324,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
var item = ScrollItemWidget.Setup(itemTemplate,
() => assetSource == source,
() => { assetSource = source; PopulateAssetList(); });
item.Get<LabelWidget>("LABEL").GetText = () => source != null ? source.Name.Replace(Platform.SupportDir, "^") : "All Packages";
item.Get<LabelWidget>("LABEL").GetText = () => source != null ? Platform.UnresolvePath(source.Name) : "All Packages";
return item;
};

View File

@@ -75,7 +75,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
{
try
{
var preview = new Bitmap(new[] { "mods", mod.Id, "preview.png" }.Aggregate(Path.Combine));
var preview = new Bitmap(Platform.ResolvePath(".", "mods", mod.Id, "preview.png"));
if (preview.Width != 296 || preview.Height != 196)
continue;
@@ -85,7 +85,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
try
{
var logo = new Bitmap(new[] { "mods", mod.Id, "logo.png" }.Aggregate(Path.Combine));
var logo = new Bitmap(Platform.ResolvePath(".", "mods", mod.Id, "logo.png"));
if (logo.Width != 96 || logo.Height != 96)
continue;