Skip to content

Commit

Permalink
Fixes duplication of imported custom icons (#621)
Browse files Browse the repository at this point in the history
  • Loading branch information
wallynm authored Dec 2, 2024
1 parent ceb8efa commit 7e85b17
Showing 1 changed file with 22 additions and 18 deletions.
40 changes: 22 additions & 18 deletions src/icon-pack-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,15 +508,17 @@ export const initIconPacks = async (plugin: IconizePlugin): Promise<void> => {
}

const prefix = createIconPackPrefix(folderName);
iconPacks.push({
name: folderName,
icons: loadedIcons,
prefix,
custom: true,
});
logger.info(
`Loaded icon pack '${folderName}' (amount of icons: ${loadedIcons.length})`,
);
if (!iconPacks.some(iconPack => iconPack.name === folderName)) {
iconPacks.push({
name: folderName,
icons: loadedIcons,
prefix,
custom: true,
});
logger.info(
`Loaded icon pack '${folderName}' (amount of icons: ${loadedIcons.length})`,
);
}
}

// Extract all files from the zip files.
Expand All @@ -531,15 +533,17 @@ export const initIconPacks = async (plugin: IconizePlugin): Promise<void> => {
continue;
}

iconPacks.push({
name: zipFile,
icons: loadedIcons,
prefix,
custom: false,
});
logger.info(
`Loaded icon pack '${zipFile}' (amount of icons: ${loadedIcons.length})`,
);
if (!iconPacks.some(iconPack => iconPack.name === zipFile)) {
iconPacks.push({
name: zipFile,
icons: loadedIcons,
prefix,
custom: false,
});
logger.info(
`Loaded icon pack '${zipFile}' (amount of icons: ${loadedIcons.length})`,
);
}
}
};

Expand Down

0 comments on commit 7e85b17

Please sign in to comment.