1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-27 23:28:38 +02:00

Doc: Added contributors

This commit is contained in:
Laurent Cozic
2019-07-18 18:36:29 +01:00
parent d45d1b4225
commit 2ba50321d4
6 changed files with 236 additions and 14 deletions

View File

@ -151,4 +151,13 @@ toolUtils.isMac = () => {
return process && process.platform === 'darwin';
}
toolUtils.insertContentIntoFile = async function (filePath, markerOpen, markerClose, contentToInsert) {
const fs = require('fs-extra');
let content = await fs.readFile(filePath, 'utf-8');
// [^]* matches any character including new lines
const regex = new RegExp(markerOpen + '[^]*?' + markerClose);
content = content.replace(regex, markerOpen + contentToInsert + markerClose);
await fs.writeFile(filePath, content);
}
module.exports = toolUtils;