Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed AssetBrowser handling multiple files with same name. #14249

Merged
merged 1 commit into from Mar 31, 2018

Conversation

Projects
None yet
5 participants
@IceReaper
Copy link
Contributor

IceReaper commented Oct 23, 2017

This fixes #14158.

@reaperrr

This comment has been minimized.

Copy link
Contributor

reaperrr commented Dec 31, 2017

This has admittedly been sitting unreviewed for far too long, but we most likely won't get this merged before the playtest, so adding to Next+1 milestone.

@reaperrr reaperrr added this to the Next + 1 milestone Dec 31, 2017

@Mailaender
Copy link
Member

Mailaender left a comment

Works as promised.

@reaperrr reaperrr modified the milestones: Next + 1, Next release Feb 18, 2018

@reaperrr

This comment has been minimized.

Copy link
Contributor

reaperrr commented Feb 18, 2018

Might be Windows-specific, but I'm getting

Error reading 50cal.shp:
Illegales Zeichen im Pfad.
bei System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional)
bei System.IO.Path.Combine(String path1, String path2)
bei OpenRA.FileSystem.Folder.Contains(String filename) in d:\dev\OpenRA\OpenRA.Game\FileSystem\Folder.cs:Zeile 50.
bei OpenRA.FileSystem.FileSystem.<>c__DisplayClass13.b__12(IReadOnlyPackage x) in d:\dev\OpenRA\OpenRA.Game\FileSystem\FileSystem.cs:Zeile 259.
bei System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable1 source, Func2 predicate)
bei OpenRA.FileSystem.FileSystem.TryOpen(String filename, Stream& s) in d:\dev\OpenRA\OpenRA.Game\FileSystem\FileSystem.cs:Zeile 259.
bei OpenRA.FileSystem.FileSystem.Open(String filename) in d:\dev\OpenRA\OpenRA.Game\FileSystem\FileSystem.cs:Zeile 212.
bei OpenRA.Graphics.SpriteLoader.GetFrames(IReadOnlyFileSystem fileSystem, String filename, ISpriteLoader[] loaders) in d:\dev\OpenRA\OpenRA.Game\Graphics\SpriteLoader.cs:Zeile 111.
bei OpenRA.Graphics.SpriteLoader.GetSprites(IReadOnlyFileSystem fileSystem, String filename, ISpriteLoader[] loaders, SheetBuilder sheetBuilder) in d:\dev\OpenRA\OpenRA.Game\Graphics\SpriteLoader.cs:Zeile 106.
bei OpenRA.Graphics.SpriteCache.LoadSprite(String filename, List1 cache) in d:\dev\OpenRA\OpenRA.Game\Graphics\SpriteLoader.cs:Zeile 61. bei OpenRA.Graphics.SpriteCache.get_Item(String filename) in d:\dev\OpenRA\OpenRA.Game\Graphics\SpriteLoader.cs:Zeile 73. bei OpenRA.Mods.Common.Widgets.Logic.AssetBrowserLogic.LoadAsset(IReadOnlyPackage package, String filename) in d:\dev\OpenRA\OpenRA.Mods.Common\Widgets\Logic\AssetBrowserLogic.cs:Zeile 343. Error reading 120mm.shp: Illegales Zeichen im Pfad. bei System.IO.Path.CheckInvalidPathChars(String path, Boolean checkAdditional) bei System.IO.Path.Combine(String path1, String path2) bei OpenRA.FileSystem.Folder.Contains(String filename) in d:\dev\OpenRA\OpenRA.Game\FileSystem\Folder.cs:Zeile 50. bei OpenRA.FileSystem.FileSystem.<>c__DisplayClass13.<TryOpen>b__12(IReadOnlyPackage x) in d:\dev\OpenRA\OpenRA.Game\FileSystem\FileSystem.cs:Zeile 259. bei System.Linq.Enumerable.LastOrDefault[TSource](IEnumerable1 source, Func2 predicate) bei OpenRA.FileSystem.FileSystem.TryOpen(String filename, Stream& s) in d:\dev\OpenRA\OpenRA.Game\FileSystem\FileSystem.cs:Zeile 259. bei OpenRA.FileSystem.FileSystem.Open(String filename) in d:\dev\OpenRA\OpenRA.Game\FileSystem\FileSystem.cs:Zeile 212. bei OpenRA.Graphics.SpriteLoader.GetFrames(IReadOnlyFileSystem fileSystem, String filename, ISpriteLoader[] loaders) in d:\dev\OpenRA\OpenRA.Game\Graphics\SpriteLoader.cs:Zeile 111. bei OpenRA.Graphics.SpriteLoader.GetSprites(IReadOnlyFileSystem fileSystem, String filename, ISpriteLoader[] loaders, SheetBuilder sheetBuilder) in d:\dev\OpenRA\OpenRA.Game\Graphics\SpriteLoader.cs:Zeile 106. bei OpenRA.Graphics.SpriteCache.LoadSprite(String filename, List1 cache) in d:\dev\OpenRA\OpenRA.Game\Graphics\SpriteLoader.cs:Zeile 61.
bei OpenRA.Graphics.SpriteCache.get_Item(String filename) in d:\dev\OpenRA\OpenRA.Game\Graphics\SpriteLoader.cs:Zeile 73.
bei OpenRA.Mods.Common.Widgets.Logic.AssetBrowserLogic.LoadAsset(IReadOnlyPackage package, String filename) in d:\dev\OpenRA\OpenRA.Mods.Common\Widgets\Logic\AssetBrowserLogic.cs:Zeile 343.
(...)

@pchote pchote modified the milestones: Next release, Next + 1 Mar 1, 2018

var fs = modData.DefaultFileSystem as OpenRA.FileSystem.FileSystem;

if (fs != null)
prefix = fs.GetPrefix(package) + "|";

This comment has been minimized.

@RoosterDragon

RoosterDragon Mar 17, 2018

Member

This change fixes it for me.

if (fs != null)
{
	prefix = fs.GetPrefix(package);
	if (prefix != null)
		prefix += "|";
}
foreach (var content in assetSource.Contents)
files.Add(content, new List<IReadOnlyPackage> {
assetSource
});

This comment has been minimized.

@RoosterDragon

RoosterDragon Mar 17, 2018

Member

I think sticking the files.Add on one line is fine.

if (!files.ContainsKey(content))
files.Add(content, new List<IReadOnlyPackage> {
mountedPackage
});

This comment has been minimized.

@RoosterDragon

RoosterDragon Mar 17, 2018

Member

I think sticking the files.Add on one line is fine.

@RoosterDragon

This comment has been minimized.

Copy link
Member

RoosterDragon commented Mar 17, 2018

With the above fix, works for me. Style comments are optional.

@pchote

This comment has been minimized.

Copy link
Member

pchote commented Mar 30, 2018

Does someone want to take this over?

@reaperrr

This comment has been minimized.

Copy link
Contributor

reaperrr commented Mar 30, 2018

I'll test it with @RoosterDragon's fix later and if I can confirm the fix, I'll push an update.

@reaperrr

This comment has been minimized.

Copy link
Contributor

reaperrr commented Mar 31, 2018

Updated with @RoosterDragon's fix, works fine as far as I can tell.

Fix asset browser displaying wrong file
If multiple files with same filename are present.

@reaperrr reaperrr force-pushed the IceReaper:AssetBrowserFix branch from c27aeb1 to 6f0f413 Mar 31, 2018

@reaperrr reaperrr merged commit 12407ae into OpenRA:bleed Mar 31, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@IceReaper IceReaper deleted the IceReaper:AssetBrowserFix branch Apr 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.