-
Notifications
You must be signed in to change notification settings - Fork 0
/
ymlFilesManager.js
44 lines (38 loc) · 1.42 KB
/
ymlFilesManager.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
const yml = require("js-yaml");
const fs = require("fs");
const SettingsTemplate = `name: "app" #Do not put any space in the name
application_type: "exe" # exe, dll, or slib
cpp_version: "auto"
build: "Debug" #Debug or Release
showSteps: true
showConsole: true # This parameter allows you to specify wheither a console should appear alongside your application or not
include:
- exemple
library_directory:
- exemple
library:
- exemple
preprocessor:
- exemple
ressources: # The ressources are folders or files that will be copied into the out folder when the compilation is over
- exemple
ignore:
- exemple
# IMPORTANT NOTICE 1: always put a space between "-" and the
# variable after. Also put a TAB space before
# IMPORTANT NOTICE 2: when adding path to your includes, dependecies, librarys or ressources,
# The path has to be relative to the workspace(poroject) root
`;
const readFile = (path) => {
const doc = yml.load(fs.readFileSync(path));
return doc;
};
const modifyFile = (field, data, path) => {
const doc = yml.load(fs.readFileSync(path));
const doc_ = doc ? doc : {};
doc_[field] = data;
fs.writeFileSync(path, yml.dump(doc_), (err) => {
console.log(err);
});
};
module.exports = { SettingsTemplate, readFile, modifyFile };