mirror of
https://github.com/marktext/marktext.git
synced 2025-05-03 19:42:07 +08:00

* side-bar-view * list files view * update the structure of store, add modules * open project and change select files * add tabs view * listen for file/dir changing, and update in sidebar * delete some unused code * context menu in sidebar * add tool bar and tab bar menu item * save all and save all and close * copy, cut, paste, new file, new directory, move to trash, open in folder * rename in sidebar
18 lines
384 B
JavaScript
18 lines
384 B
JavaScript
import fse from 'fs-extra'
|
|
|
|
export const create = (pathname, type) => {
|
|
if (type === 'directory') {
|
|
return fse.ensureDir(pathname)
|
|
} else {
|
|
return fse.outputFile(pathname, '')
|
|
}
|
|
}
|
|
|
|
export const paste = ({ src, dest, type }) => {
|
|
return type === 'cut' ? fse.move(src, dest) : fse.copy(src, dest)
|
|
}
|
|
|
|
export const rename = (src, dest) => {
|
|
return fse.move(src, dest)
|
|
}
|