通用版本
This commit is contained in:
1 parent
78c69f4737
commit
48186a3608
58 files changed
+85626
No files matched your search
@@ -0,0 +1,17 @@
|
||||
'use strict';
|
||||
const path = require('path');
|
||||
|
||||
// Preserve name + '.' + ext exactly; only split the compound suffix correctly.
|
||||
// Return through Eagle's thumbnail callback so Eagle persists its own metadata.
|
||||
function normalizeItem(src, item) {
|
||||
const filename = path.basename(src);
|
||||
const match = filename.match(/^(.*)\.(atlas\.txt|skel\.bytes)$/i);
|
||||
if (!match || !item || !item.ext) return false;
|
||||
if (item.name + '.' + item.ext !== filename) return false;
|
||||
if (item.name === match[1] && item.ext === match[2]) return false;
|
||||
item.name = match[1]; item.ext = match[2];
|
||||
delete item.text;
|
||||
return true;
|
||||
}
|
||||
|
||||
module.exports = { normalizeItem };
|
||||
Reference in new issue
Block a user