验收20%
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
#target photoshop
|
||||
|
||||
app.displayDialogs = DialogModes.NO;
|
||||
|
||||
var openedDocument = null;
|
||||
|
||||
function readJson(filePath) {
|
||||
var file = File(filePath);
|
||||
if (!file.exists) {
|
||||
throw new Error('Manifest does not exist: ' + filePath);
|
||||
}
|
||||
file.encoding = 'UTF8';
|
||||
if (!file.open('r')) {
|
||||
throw new Error('Unable to open manifest: ' + filePath);
|
||||
}
|
||||
var content = file.read();
|
||||
file.close();
|
||||
return eval('(' + content + ')');
|
||||
}
|
||||
|
||||
try {
|
||||
var manifest = readJson(JIAPU_A01_MANIFEST);
|
||||
var psdFile = File(JIAPU_A01_PSD);
|
||||
if (!psdFile.exists) {
|
||||
throw new Error('PSD does not exist: ' + psdFile.fsName);
|
||||
}
|
||||
openedDocument = app.open(psdFile);
|
||||
if (manifest.exports.length !== 0) {
|
||||
throw new Error('Layer export is not implemented until assets are approved.');
|
||||
}
|
||||
openedDocument.close(SaveOptions.DONOTSAVECHANGES);
|
||||
openedDocument = null;
|
||||
} catch (error) {
|
||||
if (openedDocument !== null) {
|
||||
openedDocument.close(SaveOptions.DONOTSAVECHANGES);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
Reference in New Issue
Block a user