Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
]).then(() => box.watch()).then(() => fs.rename(src, newSrc)).delay(500).then(() => {
const lastTwoCalls = processor.args.slice(processor.args.length - 2, processor.args.length);
]).then(() => box.watch()).then(() => fs.rename(pathFn.join(box.base, 'a'), pathFn.join(box.base, 'b'))).delay(500).then(() => {
const lastTwoCalls = processor.args.slice(processor.args.length - 2, processor.args.length);
moveToDraft(article, workspace) {
const draft_dir = this.draft_dir;
const filename = (article.filename ? article.filename : article.title) + suffix;
const oldPath = this.getPathByWorkspace(workspace) + filename;
const newPath = draft_dir + filename;
fs.rename(oldPath, newPath)
.then((err) => {
if (err) {
console.err(err);
}
});
}
moveToTrash(article, workspace) {
const trash_dir = this.trash_dir;
const filename = article.filename + suffix;
const oldPath = this.getPathByWorkspace(workspace) + filename;
const newPath = trash_dir + filename;
fs.rename(oldPath, newPath)
.then((err) => {
if (err) {
console.err(err);
}
});
}
moveToPost(article, workspace) {
const filename = article.filename + suffix;
const oldPath = this.getPathByWorkspace(workspace) + filename;
const newPath = this.post_dir + filename;
fs.rename(oldPath, newPath)
.then((err) => {
if (err) {
console.err(err);
}
});
}
publish(id) {
if (this.type === "Page") return;
let post = this.detail(id);
let postDir = path.join(this.hexo.source_dir, '_posts');
let newFullSource = path.join(postDir, path.basename(post.full_source));
return fs.rename(post.full_source, newFullSource).then(() => this.updateDB());
}
.then(() => fs.rename(post.full_source, newFullSource))
.then(() => this.updateDB());