Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
[ "zpl.c", "zpl.h" ],
[ "zpl.c", "zpl_math.h" ],
]
const files = [
'CMakeLists.txt',
'LICENSE',
]
const pkg = './pkg/'
const pkg_includes = './pkg/librg/'
// recreate pkg dir
fs.rmdirSync(pkg)
fs.mkdirSync(pkg)
fs.mkdirSync(pkg_includes)
// copy header files
libs.map(lib => fs.copyFileSync(
'./node_modules/' + lib[0] + '/include/' + lib[1],
pkg_includes + lib[1]
))
// copy librg
fs.copyFileSync('./include/librg.h', pkg_includes + 'librg.h')
// copy files else
files.map(file => fs.copyFileSync(file, pkg + file))
function copyGameFromNodeModules(game, enable) {
enable = 'undefined' === typeof enable ? true : enable;
let gameDir = path.resolve(GAMES_AVAILABLE_DIR, game);
// Move game from node_modules into games_available directory.
fs.renameSync(path.resolve(INSTALL_DIR_MODULES, game), gameDir);
// Make sure that the test command works.
let tmpPath = path.join(gameDir, 'node_modules');
if (!fs.existsSync(tmpPath)) fs.mkdirSync(tmpPath);
tmpPath = path.join(tmpPath, '.bin');
if (!fs.existsSync(tmpPath)) fs.mkdirSync(tmpPath);
tmpPath = path.join(tmpPath, 'mocha');
if (!fs.existsSync(tmpPath)) {
makeLink(path.join(INSTALL_DIR_MODULES, '.bin/mocha'), tmpPath);
}
if (!enable) return;
// Enable it.
makeLink(gameDir, path.resolve(GAMES_ENABLED_DIR, game));
}
test('rmdir', function (done) {
expect.assertions(2)
var dir = join(
os.tmpdir(),
Math.random()
.toString(16)
.slice(2)
)
fs.mkdirSync(dir)
fs.mkdirSync(join(dir, 'dir'))
subfs({ dir, fs }).rmdir('dir', function (err) {
expect(err).toBeFalsy()
expect(fs.existsSync(join(dir, 'dir'))).toBeFalsy()
done()
})
})
var fs = require('fs');
var Window = require('./Window');
var dir = process.env['APPDATA'] + '\\PoeController';
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
if(!fs.existsSync(dir)) {
Window.quit('Could not create folder: ' + dir);
}
}
module.exports = {
DATA_PATH: dir
};
function build(buildSpecs) {
var i, moduleName, moduleDesc, moduleMain, moduleMainPath;
console.log("-> Creating New Build Directories");
fs.mkdirSync(curDir + '/build/client', '0777');
fs.mkdirSync(curDir + '/build/client/staticResources', '0777');
fs.mkdirSync(curDir + '/build/client/buildLib', '0777');
console.log('-> Copying project modules to build directory');
for (moduleName in buildSpecs.projectConfig.projectModules) {
if (buildSpecs.projectConfig.projectModules.hasOwnProperty(moduleName)) {
moduleDesc = buildSpecs.projectConfig.projectModules[moduleName];
moduleMain = moduleDesc.main;
logAndThrowIf(moduleMain && (
moduleMain.length < 6 || moduleMain.substr(0,2) !== './' ||
moduleMain.substr(moduleMain.length-3) !== '.js'),
'If a main module is specified (' + moduleMain + ') then it must begin with' +
'"./" and end with ".js" indicating the file inside of lib/ModuleName');
logAndThrowIf(buildSpecs.libDirContentsArr.indexOf(moduleName) === -1,
'Cannot find a directory with module name ' + moduleName + ' in lib -' +
const start = async () => {
await mongoose.connect(dbUrl, { useNewUrlParser: true });
if (!fs.existsSync(dataFolder))
fs.mkdirSync(dataFolder);
console.log('started');
bot.startPolling();
await service();
};
var classifierId = req.params.classifierId;
var classifierClass = req.params.classifierClass;
var currentTime = new Date().getTime()
if (posneg == "positive" || posneg == "negative"){
//console.log(id, posneg, classifierId, classifierClass)
console.log("retraining")
var rootDir = './temp';
var dir = rootDir + "/" + currentTime;
if (!fs.existsSync(rootDir)){
fs.mkdirSync(rootDir);
}
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
}
var tempFile = dir + "/" + id + ".jpg";
var resizedFile = dir + "/" + id + "-resize.jpg";
var zipFile = dir + "/" + id + ".zip";
var cleanup = function() {
console.log("cleanup");
fs.unlink(tempFile, function (err) { })
fs.unlink(resizedFile, function (err) { })
fs.unlink(zipFile, function (err) { })
fs.rmdir(dir, function (err) { })
}
db.attachment.get(id, "image.jpg", function(err, attachmentBody) {
if (err) {
db.files.remove({});
db.assets.remove({});
db.sequences.remove({});
db.compositions.remove({});
try {
//remove the projects folder and it's content
wrench.rmdirSyncRecursive(PROJECTS_PATH);
//check if folder exists
var exists = fs.existsSync(PROJECTS_PATH);
//recreate the just removed dir
if (!exists) {
fs.mkdirSync(PROJECTS_PATH, parseInt('777', 8));
}
callback();
}
catch (e) {
callback();
}
};
const mkdir = (p) => {
if (fs.existsSync(p) == false) {
mkdir(path.dirname(p));
fs.mkdirSync(p);
}
};