mirror of
https://github.com/aelurum/AssetStudio.git
synced 2026-11-15 19:28:48 -05:00
Improve search for external files
This commit is contained in:
@@ -222,6 +222,8 @@ namespace AssetStudio
|
|||||||
if (fromZip)
|
if (fromZip)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
DirectoryInfo dirInfo = null;
|
||||||
|
FileInfo[] fileInfoArray = null;
|
||||||
foreach (var sharedFile in assetsFile.m_Externals)
|
foreach (var sharedFile in assetsFile.m_Externals)
|
||||||
{
|
{
|
||||||
var sharedFileName = sharedFile.fileName;
|
var sharedFileName = sharedFile.fileName;
|
||||||
@@ -231,15 +233,20 @@ namespace AssetStudio
|
|||||||
var sharedFilePath = Path.Combine(dirName, sharedFileName);
|
var sharedFilePath = Path.Combine(dirName, sharedFileName);
|
||||||
if (!noexistFiles.Contains(sharedFilePath))
|
if (!noexistFiles.Contains(sharedFilePath))
|
||||||
{
|
{
|
||||||
if (!File.Exists(sharedFilePath))
|
var isFileExist = File.Exists(sharedFilePath);
|
||||||
|
if (!isFileExist)
|
||||||
{
|
{
|
||||||
var findFiles = Directory.GetFiles(dirName, sharedFileName, SearchOption.AllDirectories);
|
dirInfo = dirInfo ?? new DirectoryInfo(dirName);
|
||||||
if (findFiles.Length > 0)
|
fileInfoArray = fileInfoArray ?? dirInfo.GetFiles("*.*", SearchOption.AllDirectories);
|
||||||
|
|
||||||
|
var fileInfo = fileInfoArray.FirstOrDefault(x => x.Name == sharedFileName);
|
||||||
|
if (fileInfo != null)
|
||||||
{
|
{
|
||||||
sharedFilePath = findFiles[0];
|
sharedFilePath = fileInfo.FullName;
|
||||||
|
isFileExist = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (File.Exists(sharedFilePath))
|
if (isFileExist)
|
||||||
{
|
{
|
||||||
importFiles.Add(sharedFilePath);
|
importFiles.Add(sharedFilePath);
|
||||||
importFilesHash.Add(sharedFileName);
|
importFilesHash.Add(sharedFileName);
|
||||||
|
|||||||
Reference in New Issue
Block a user