Give an proper error when a file is not found
This commit is contained in:
@@ -267,6 +267,12 @@ namespace OpenRA.FileSystem
|
|||||||
if (s != null)
|
if (s != null)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// The file should be in an explicit package (but we couldn't find it)
|
||||||
|
// Thus don't try to find it using the filename (which contains the invalid '|' char)
|
||||||
|
// This can be removed once the TODO below is resolved
|
||||||
|
if (explicitSplit > 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Ask each package individually
|
// Ask each package individually
|
||||||
// TODO: This fallback can be removed once the filesystem cleanups are complete
|
// TODO: This fallback can be removed once the filesystem cleanups are complete
|
||||||
var package = mountedPackages.Keys.LastOrDefault(x => x.Contains(filename));
|
var package = mountedPackages.Keys.LastOrDefault(x => x.Contains(filename));
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
*/
|
*/
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
@@ -47,7 +48,7 @@ namespace OpenRA.FileSystem
|
|||||||
public bool Contains(string filename)
|
public bool Contains(string filename)
|
||||||
{
|
{
|
||||||
var combined = Path.Combine(path, filename);
|
var combined = Path.Combine(path, filename);
|
||||||
return combined.StartsWith(path) && File.Exists(combined);
|
return combined.StartsWith(path, StringComparison.Ordinal) && File.Exists(combined);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Update(string filename, byte[] contents)
|
public void Update(string filename, byte[] contents)
|
||||||
|
|||||||
Reference in New Issue
Block a user