Skip to content

Commit f4b876c

Browse files
author
Jiang Yin
committed
路径字符串的比较忽略语言文化
1 parent 4c4212c commit f4b876c

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Scripts/Editor/ResourceBuilder/ResourceBuilderController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ private bool BuildResources(Platform platform, AssetBundleBuild[] assetBundleBui
833833
List<string> validNames = new List<string>();
834834
foreach (ResourceData assetBundleResourceData in assetBundleResourceDatas)
835835
{
836-
validNames.Add(GetResourceFullName(assetBundleResourceData.Name, assetBundleResourceData.Variant).ToLower());
836+
validNames.Add(GetResourceFullName(assetBundleResourceData.Name, assetBundleResourceData.Variant).ToLowerInvariant());
837837
}
838838

839839
if (Directory.Exists(workingPath))
@@ -1018,7 +1018,7 @@ private bool ProcessAssetBundle(Platform platform, string workingPath, string ou
10181018
{
10191019
string fullName = GetResourceFullName(name, variant);
10201020
ResourceData resourceData = m_ResourceDatas[fullName];
1021-
string workingName = Utility.Path.GetRegularPath(Path.Combine(workingPath, fullName.ToLower()));
1021+
string workingName = Utility.Path.GetRegularPath(Path.Combine(workingPath, fullName.ToLowerInvariant()));
10221022

10231023
byte[] bytes = File.ReadAllBytes(workingName);
10241024
int length = bytes.Length;

Scripts/Editor/ResourceCollection/ResourceCollection.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public Resource GetResource(string name, string variant)
282282
}
283283

284284
Resource resource = null;
285-
if (m_Resources.TryGetValue(GetResourceFullName(name, variant).ToLower(), out resource))
285+
if (m_Resources.TryGetValue(GetResourceFullName(name, variant).ToLowerInvariant(), out resource))
286286
{
287287
return resource;
288288
}
@@ -297,7 +297,7 @@ public bool HasResource(string name, string variant)
297297
return false;
298298
}
299299

300-
return m_Resources.ContainsKey(GetResourceFullName(name, variant).ToLower());
300+
return m_Resources.ContainsKey(GetResourceFullName(name, variant).ToLowerInvariant());
301301
}
302302

303303
public bool AddResource(string name, string variant, string fileSystem, LoadType loadType, bool packed)
@@ -323,7 +323,7 @@ public bool AddResource(string name, string variant, string fileSystem, LoadType
323323
}
324324

325325
Resource resource = Resource.Create(name, variant, fileSystem, loadType, packed, resourceGroups);
326-
m_Resources.Add(resource.FullName.ToLower(), resource);
326+
m_Resources.Add(resource.FullName.ToLowerInvariant(), resource);
327327

328328
return true;
329329
}
@@ -351,9 +351,9 @@ public bool RenameResource(string oldName, string oldVariant, string newName, st
351351
return false;
352352
}
353353

354-
m_Resources.Remove(resource.FullName.ToLower());
354+
m_Resources.Remove(resource.FullName.ToLowerInvariant());
355355
resource.Rename(newName, newVariant);
356-
m_Resources.Add(resource.FullName.ToLower(), resource);
356+
m_Resources.Add(resource.FullName.ToLowerInvariant(), resource);
357357

358358
return true;
359359
}
@@ -373,7 +373,7 @@ public bool RemoveResource(string name, string variant)
373373

374374
Asset[] assets = resource.GetAssets();
375375
resource.Clear();
376-
m_Resources.Remove(resource.FullName.ToLower());
376+
m_Resources.Remove(resource.FullName.ToLowerInvariant());
377377
foreach (Asset asset in assets)
378378
{
379379
m_Assets.Remove(asset.Guid);
@@ -500,7 +500,7 @@ public bool AssignAsset(string guid, string name, string variant)
500500
continue;
501501
}
502502

503-
if (assetInResource.Name.ToLower() == assetName.ToLower())
503+
if (assetInResource.Name.ToLowerInvariant() == assetName.ToLowerInvariant())
504504
{
505505
return false;
506506
}
@@ -617,7 +617,7 @@ private bool IsAvailableResourceName(string name, string variant, Resource curre
617617
string[] pathNames = resource.Name.Split('/');
618618
for (int i = 0; i < foundPathNames.Length - 1 && i < pathNames.Length - 1; i++)
619619
{
620-
if (foundPathNames[i].ToLower() != pathNames[i].ToLower())
620+
if (foundPathNames[i].ToLowerInvariant() != pathNames[i].ToLowerInvariant())
621621
{
622622
break;
623623
}

Scripts/Runtime/Resource/EditorResourceComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1530,7 +1530,7 @@ private bool HasFile(string assetName)
15301530

15311531
if (assetFullName != fileFullName)
15321532
{
1533-
if (assetFullName.ToLower() == fileFullName.ToLower())
1533+
if (assetFullName.ToLowerInvariant() == fileFullName.ToLowerInvariant())
15341534
{
15351535
Log.Warning("The real path of the specific asset '{0}' is '{1}'. Check the case of letters in the path.", assetName, "Assets" + fileFullName.Substring(Application.dataPath.Length));
15361536
}

0 commit comments

Comments
 (0)