【发布时间】:2019-04-13 07:39:52
【问题描述】:
我想要做的是在保存之前在特定目录中制作文件副本。
@sss= new CompositeDisposable
@sss.add atom.workspace.observeTextEditors (editor)=>
@sss.add editor.buffer.onWillSave => # BUG: this is not working till I lunch web browser
#if atom.config.get("search-the-web.browser.verbose_backup_directory") is not 'null'
file_prefix = new Date().toLocaleString().replace(/(\d+)\/(\d+)\/(\d+).*?(\d+):(\d+):(\d+) .*/,"$3$1$2$4$5$6")
copyPath = atom.config.get("search-the-web.browser.verbose_backup_directory") + editor.buffer.file.path.replace(/(.):/,"\\$1").replace(/(\.(?:.(?!\.))+$)/,"-#{file_prefix}$1")
console.log(copyPath);
文件文档:https://atom.io/docs/api/v1.31.2/File
目录文档:https://atom.io/docs/api/v1.31.2/Directory
我无法理解 atom.io 网站上的文档,也没有在互联网上找到任何相关答案,请有人帮忙。我正在使用咖啡脚本
【问题讨论】:
标签: javascript jquery node.js coffeescript atom-editor