Commit 8417141f authored by rockyl's avatar rockyl

修复png内容为空的情况

parent 45dacb44
......@@ -280,14 +280,15 @@ async function execute$1(psdFile, options) {
const uuid = generateUUID();
const ext = '.png';
properties.source = 'asset://' + uuid;
const imageFilePath = path.join(imagesPath, uuid + ext);
await fs.ensureDir(path.dirname(imageFilePath));
let png = node.origin.toPng();
let buffer = await savePng(png, imageFilePath);
let buffer = await savePng(png, imageFilePath).catch(e=>{});
//await node.origin.saveAsPng(imageFilePath);
if(buffer){
properties.source = 'asset://' + uuid;
const hashFileName = hash(buffer);
const hashFilePath = path.join(imagesPath, hashFileName + ext);
await fs.rename(imageFilePath, hashFilePath);
......@@ -300,6 +301,7 @@ async function execute$1(psdFile, options) {
});
}
}
}
let viewParent = parent.view || viewRoot;
if (!viewParent.hasOwnProperty('children')) {
......
This diff is collapsed.
......@@ -286,14 +286,15 @@ async function execute$1(psdFile, options) {
const uuid = generateUUID();
const ext = '.png';
properties.source = 'asset://' + uuid;
const imageFilePath = path.join(imagesPath, uuid + ext);
await fs.ensureDir(path.dirname(imageFilePath));
let png = node.origin.toPng();
let buffer = await savePng(png, imageFilePath);
let buffer = await savePng(png, imageFilePath).catch(e=>{});
//await node.origin.saveAsPng(imageFilePath);
if(buffer){
properties.source = 'asset://' + uuid;
const hashFileName = hash(buffer);
const hashFilePath = path.join(imagesPath, hashFileName + ext);
await fs.rename(imageFilePath, hashFilePath);
......@@ -306,6 +307,7 @@ async function execute$1(psdFile, options) {
});
}
}
}
let viewParent = parent.view || viewRoot;
if (!viewParent.hasOwnProperty('children')) {
......
This diff is collapsed.
......@@ -286,14 +286,15 @@
const uuid = generateUUID();
const ext = '.png';
properties.source = 'asset://' + uuid;
const imageFilePath = path.join(imagesPath, uuid + ext);
await fs.ensureDir(path.dirname(imageFilePath));
let png = node.origin.toPng();
let buffer = await savePng(png, imageFilePath);
let buffer = await savePng(png, imageFilePath).catch(e=>{});
//await node.origin.saveAsPng(imageFilePath);
if(buffer){
properties.source = 'asset://' + uuid;
const hashFileName = hash(buffer);
const hashFilePath = path.join(imagesPath, hashFileName + ext);
await fs.rename(imageFilePath, hashFilePath);
......@@ -306,6 +307,7 @@
});
}
}
}
let viewParent = parent.view || viewRoot;
if (!viewParent.hasOwnProperty('children')) {
......
This diff is collapsed.
......@@ -73,14 +73,15 @@ export async function execute(psdFile, options) {
const uuid = generateUUID();
const ext = '.png';
properties.source = 'asset://' + uuid;
const imageFilePath = path.join(imagesPath, uuid + ext);
await fs.ensureDir(path.dirname(imageFilePath));
let png = node.origin.toPng();
let buffer = await savePng(png, imageFilePath);
let buffer = await savePng(png, imageFilePath).catch(e=>{});
//await node.origin.saveAsPng(imageFilePath);
if(buffer){
properties.source = 'asset://' + uuid;
const hashFileName = hash(buffer);
const hashFilePath = path.join(imagesPath, hashFileName + ext);
await fs.rename(imageFilePath, hashFilePath);
......@@ -93,6 +94,7 @@ export async function execute(psdFile, options) {
});
}
}
}
let viewParent = parent.view || viewRoot;
if (!viewParent.hasOwnProperty('children')) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment