【优化】path检查时严格检查文件大小写
parent
82fbdb513f
commit
7bc489e15e
|
|
@ -183,7 +183,7 @@ namespace Luban.Client.Common.Net
|
||||||
private bool CheckSubResourceExists(string mainResFileName, string subResName)
|
private bool CheckSubResourceExists(string mainResFileName, string subResName)
|
||||||
{
|
{
|
||||||
s_logger.Debug("check resources main:{} sub:{}", mainResFileName, subResName);
|
s_logger.Debug("check resources main:{} sub:{}", mainResFileName, subResName);
|
||||||
if (!File.Exists(mainResFileName))
|
if (!FileUtil.IsFileExistsSenseCase(mainResFileName))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -236,7 +236,7 @@ namespace Luban.Client.Common.Net
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tasks.Add(Task.Run(() => File.Exists(Path.Combine(root, f))));
|
tasks.Add(Task.Run(() => FileUtil.IsFileExistsSenseCase(Path.Combine(root, f))));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ namespace Luban.Client.Common.Utils
|
||||||
|
|
||||||
public void AddOutputDir(string dir)
|
public void AddOutputDir(string dir)
|
||||||
{
|
{
|
||||||
dir = dir.TrimEnd('/', '\\');
|
dir = Path.TrimEndingDirectorySeparator(dir);
|
||||||
_outputDirs.Add(dir);
|
_outputDirs.Add(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
|
@ -49,6 +51,24 @@ namespace Luban.Common.Utils
|
||||||
return Combine(GetParent(rootFile), file);
|
return Combine(GetParent(rootFile), file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsFileExistsSenseCase(string path)
|
||||||
|
{
|
||||||
|
if (!File.Exists(path))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (OperatingSystem.IsWindows())
|
||||||
|
{
|
||||||
|
var fileName = Path.GetFileName(path);
|
||||||
|
var files = Directory.GetFiles(Path.GetDirectoryName(path), fileName, new EnumerationOptions() { MatchCasing = MatchCasing.CaseSensitive });
|
||||||
|
return files.Length > 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 忽略以 文件名以 '.' '_' '~' 开头的文件
|
/// 忽略以 文件名以 '.' '_' '~' 开头的文件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue