Fix copy to website script to work if main-partial is missing.
This commit is contained in:
parent
b9423bc831
commit
0a43f6bbec
1 changed files with 10 additions and 1 deletions
|
@ -17,7 +17,16 @@ function onCopy(err) {
|
||||||
|
|
||||||
console.log('Copied static files to piskel-website...');
|
console.log('Copied static files to piskel-website...');
|
||||||
let previousPartialPath = path.resolve(PISKELAPP_PATH, 'templates/editor/main-partial.html');
|
let previousPartialPath = path.resolve(PISKELAPP_PATH, 'templates/editor/main-partial.html');
|
||||||
fs.unlink(previousPartialPath, onDeletePreviousPartial);
|
fs.access(previousPartialPath, fs.constants.F_OK, function (err) {
|
||||||
|
if (err) {
|
||||||
|
// File does not exit, call next step directly.
|
||||||
|
console.error('Previous main partial doesn\'t exist yet.');
|
||||||
|
onDeletePreviousPartial();
|
||||||
|
} else {
|
||||||
|
// File exists, try to delete it before moving on.
|
||||||
|
fs.unlink(previousPartialPath, onDeletePreviousPartial);
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDeletePreviousPartial(err) {
|
function onDeletePreviousPartial(err) {
|
||||||
|
|
Loading…
Reference in a new issue