Skip to content

Commit

Permalink
fix: folder ends with '~' should be ignored #72
Browse files Browse the repository at this point in the history
  • Loading branch information
favoyang committed Mar 31, 2022
1 parent 1204939 commit 491c169
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Editor/AddressableImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,20 +57,26 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse
#endif
foreach (var importedAsset in importedAssets)
{
if (IsAssetIgnored(importedAsset))
continue;
if (prefabStage == null || prefabAssetPath != importedAsset) // Ignore current editing prefab asset.
dirty |= ApplyImportRule(importedAsset, null, settings, importSettings);
}

for (var i = 0; i < movedAssets.Length; i++)
{
var movedAsset = movedAssets[i];
if (IsAssetIgnored(movedAsset))
continue;
var movedFromAssetPath = movedFromAssetPaths[i];
if (prefabStage == null || prefabAssetPath != movedAsset) // Ignore current editing prefab asset.
dirty |= ApplyImportRule(movedAsset, movedFromAssetPath, settings, importSettings);
}

foreach (var deletedAsset in deletedAssets)
{
if (IsAssetIgnored(deletedAsset))
continue;
if (TryGetMatchedRule(deletedAsset, importSettings, out var matchedRule))
{
var guid = AssetDatabase.AssetPathToGUID(deletedAsset);
Expand All @@ -88,6 +94,11 @@ static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAsse
}
}

static bool IsAssetIgnored(string assetPath)
{
return assetPath.EndsWith(".meta") || assetPath.EndsWith(".DS_Store") || assetPath.EndsWith("~");
}

static AddressableAssetGroup CreateAssetGroup<SchemaType>(AddressableAssetSettings settings, string groupName)
{
return settings.CreateGroup(groupName, false, false, false, new List<AddressableAssetGroupSchema> { settings.DefaultGroup.Schemas[0] }, typeof(SchemaType));
Expand Down Expand Up @@ -281,7 +292,7 @@ public static void ReimportFolders(IEnumerable<String> assetPaths)
foreach (var file in filesToAdd)
{
// Filter out meta and DS_Store files.
if (!file.EndsWith(".meta") && !file.EndsWith(".DS_Store"))
if (!IsAssetIgnored(file))
{
pathsToImport.Add(file.Replace('\\', '/'));
}
Expand Down

0 comments on commit 491c169

Please sign in to comment.