mirror of
https://github.com/captbaritone/webamp
synced 2024-11-22 16:20:49 +00:00
Throw an error if a skin is classic AND modern
This commit is contained in:
parent
8ae08dce40
commit
69da26fb7c
@ -123,10 +123,15 @@ async function addClassicSkinFromBuffer(
|
||||
}
|
||||
|
||||
export async function getSkinType(zip: JSZip): Promise<SkinType> {
|
||||
if (zip.file(/main\.bmp$/i).length > 0) {
|
||||
const classic = (zip.file(/main\.bmp$/i).length > 0)
|
||||
const modern = (zip.file(/skin\.xml$/i).length > 0);
|
||||
if (classic && modern) {
|
||||
throw new Error("Skin is both modern and classic.");
|
||||
}
|
||||
if (classic) {
|
||||
return "CLASSIC";
|
||||
}
|
||||
if (zip.file(/skin\.xml$/i).length > 0) {
|
||||
if (modern) {
|
||||
return "MODERN";
|
||||
}
|
||||
throw new Error("Not a skin");
|
||||
|
Loading…
Reference in New Issue
Block a user