fix: move no longer crash for non-existant sub-directory dest
This commit is contained in:
parent
4632330d7c
commit
36a6bc0827
@ -5,7 +5,7 @@
|
|||||||
const Git = require('git-wrapper2-promise')
|
const Git = require('git-wrapper2-promise')
|
||||||
const Promise = require('bluebird')
|
const Promise = require('bluebird')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
const fs = Promise.promisifyAll(require('fs'))
|
const fs = Promise.promisifyAll(require('fs-extra'))
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
const URL = require('url')
|
const URL = require('url')
|
||||||
|
|
||||||
@ -229,7 +229,9 @@ module.exports = {
|
|||||||
let self = this
|
let self = this
|
||||||
let gitFilePath = entryPath + '.md'
|
let gitFilePath = entryPath + '.md'
|
||||||
let gitNewFilePath = newEntryPath + '.md'
|
let gitNewFilePath = newEntryPath + '.md'
|
||||||
|
let destPathObj = path.parse(this.getRepoPath() + '/' + gitNewFilePath)
|
||||||
|
|
||||||
|
return fs.ensureDir(destPathObj.dir).then(() => {
|
||||||
return self._git.exec('mv', [gitFilePath, gitNewFilePath]).then((cProc) => {
|
return self._git.exec('mv', [gitFilePath, gitNewFilePath]).then((cProc) => {
|
||||||
let out = cProc.stdout.toString()
|
let out = cProc.stdout.toString()
|
||||||
if (_.includes(out, 'fatal')) {
|
if (_.includes(out, 'fatal')) {
|
||||||
@ -238,6 +240,7 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
})
|
})
|
||||||
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -9,7 +9,7 @@ block rootNavRight
|
|||||||
a.button.is-outlined(v-on:click='$store.dispatch("modalDiscardPage/open")')
|
a.button.is-outlined(v-on:click='$store.dispatch("modalDiscardPage/open")')
|
||||||
i.icon-cross
|
i.icon-cross
|
||||||
span= t('nav.discard')
|
span= t('nav.discard')
|
||||||
a.button(v-on:click='$root.$emit("editor-save")')
|
a.button(v-on:click='$root.$emit("editor/save")')
|
||||||
i.icon-check
|
i.icon-check
|
||||||
span= t('nav.savedocument')
|
span= t('nav.savedocument')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user