mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-26 23:24:00 +08:00
(FileExists): check filename without directory first.
This commit is contained in:
parent
97aed46293
commit
a7d9b9c8dd
@ -263,7 +263,9 @@ namespace GameRes
|
||||
|
||||
public bool FileExists (string filename)
|
||||
{
|
||||
return m_dir.ContainsKey (CombinePath (CurrentDirectory, filename));
|
||||
return m_dir.ContainsKey (filename)
|
||||
|| !string.IsNullOrEmpty (CurrentDirectory)
|
||||
&& m_dir.ContainsKey (CombinePath (CurrentDirectory, filename));
|
||||
}
|
||||
|
||||
public Stream OpenStream (Entry entry)
|
||||
@ -408,6 +410,8 @@ namespace GameRes
|
||||
Entry entry = null;
|
||||
if (m_dir.TryGetValue (filename, out entry))
|
||||
return entry;
|
||||
if (m_dir.TryGetValue (CombinePath (CurrentDirectory, filename), out entry))
|
||||
return entry;
|
||||
var dir_name = filename + PathDelimiter;
|
||||
if (m_dir.Keys.Any (n => n.StartsWith (dir_name)))
|
||||
return new SubDirEntry (filename);
|
||||
|
Loading…
Reference in New Issue
Block a user