File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,34 +11,19 @@ public class SettingLoader
1111 /// <summary>
1212 /// 加载所有匹配的配置文件
1313 /// </summary>
14- /// <param name="fileName">文件名(可包含扩展名,若无则默认.json) </param>
14+ /// <param name="fileName">文件名</param>
1515 /// <returns>文件路径列表</returns>
1616 public static List < string > LoadSettingsData ( string fileName )
1717 {
1818 var guids = AssetDatabase . FindAssets ( $ "t:textasset") ;
1919 var results = new List < string > ( 16 ) ;
20-
21- string extension = Path . GetExtension ( fileName ) ;
22- string namePart = Path . GetFileNameWithoutExtension ( fileName ) ;
23-
24- if ( string . IsNullOrEmpty ( extension ) )
25- {
26- extension = ".json" ;
27- }
28-
2920 foreach ( var guid in guids )
3021 {
3122 string path = AssetDatabase . GUIDToAssetPath ( guid ) ;
3223 var newFileName = Path . GetFileName ( path ) ;
3324
34- // 检查扩展名是否匹配
35- if ( ! newFileName . EndsWith ( extension , System . StringComparison . OrdinalIgnoreCase ) )
36- {
37- continue ;
38- }
39-
40- // 检查文件名是否包含指定的部分
41- if ( newFileName . IndexOf ( namePart , System . StringComparison . OrdinalIgnoreCase ) >= 0 )
25+ // 检查文件名是否完全匹配
26+ if ( newFileName . Equals ( fileName , System . StringComparison . OrdinalIgnoreCase ) )
4227 {
4328 results . Add ( path ) ;
4429 }
You can’t perform that action at this time.
0 commit comments