2023-07-08 06:19:49 -05:00
|
|
|
/* -*- js-indent-level: 8 -*- */
|
2020-01-14 12:14:18 -06:00
|
|
|
/* global require Promise */
|
2020-01-14 11:08:51 -06:00
|
|
|
|
2020-01-14 12:14:18 -06:00
|
|
|
var fs = require('fs');
|
2021-06-07 04:32:53 -05:00
|
|
|
var list = require('./selectorList').list;
|
2020-01-14 11:08:51 -06:00
|
|
|
|
2020-01-14 12:14:18 -06:00
|
|
|
function copyFile(args) {
|
|
|
|
return new Promise(function(resolve) {
|
|
|
|
var sourceFile = args.sourceDir + args.fileName;
|
2021-12-17 00:44:05 -06:00
|
|
|
var destFileName;
|
|
|
|
if (args.destFileName) {
|
|
|
|
destFileName = args.destFileName;
|
|
|
|
} else {
|
|
|
|
destFileName = args.fileName;
|
|
|
|
}
|
|
|
|
|
|
|
|
var destFile = args.destDir + destFileName;
|
2020-01-14 11:08:51 -06:00
|
|
|
|
2020-01-14 12:14:18 -06:00
|
|
|
if (fs.existsSync(sourceFile)) {
|
|
|
|
fs.mkdirSync(args.destDir, { recursive: true });
|
2020-03-11 11:16:06 -05:00
|
|
|
if (fs.existsSync(destFile)) {
|
|
|
|
fs.unlinkSync(destFile);
|
|
|
|
}
|
2020-01-14 12:14:18 -06:00
|
|
|
fs.writeFileSync(destFile, fs.readFileSync(sourceFile));
|
|
|
|
resolve('File ${sourceFile} copied to ${destFile}');
|
|
|
|
}
|
|
|
|
resolve('File ${sourceFile} does not exist');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-06-07 04:32:53 -05:00
|
|
|
function getSelectors(args) {
|
|
|
|
if (args.mode === 'notebookbar') {
|
|
|
|
return list[args.name][0];
|
|
|
|
} else {
|
|
|
|
return list[args.name][1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-14 12:14:18 -06:00
|
|
|
module.exports.copyFile = copyFile;
|
2021-06-07 04:32:53 -05:00
|
|
|
module.exports.getSelectors = getSelectors;
|