Code cleanup and comments

- Added description for cleanup function
- Removed unused variable clean and moved assignment of cleanup-function
- removed index parameter from deleteFolder function in caching.js
pull/8/head
Julius Riegel 6 years ago
parent 0f4c0de2d8
commit 64490a53ff

@ -98,7 +98,7 @@ exports.cleanup = function () {
*/
var deleteFolder = function(p) {
if( fs.existsSync(p) ) {
fs.readdirSync(p).forEach(function(file,index){ // get the contents of the directory
fs.readdirSync(p).forEach(function(file){ // get the contents of the directory
var curPath = path.join(p, file); // create path by joining
if(fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolder(curPath); // call recursive

@ -9,8 +9,6 @@ const fs = require('fs'),
// own modules
utils = require("./lib/utils"),
prepro = require("./lib/preprocessor"),
// cleanup
clean = utils.Cleanup(cleanup),
// args
args = require('args-parser')(process.argv), // create an args parser
// config file
@ -163,6 +161,9 @@ function getMount(uri) {
return false;
}
/**
* A cleanup-function that should only be called on process exit
*/
function cleanup() {
logger.info('Cleanup...');
prepro.cleanup(); // cleanup the preprocessor
@ -171,6 +172,7 @@ function cleanup() {
// Executing the main function
if (typeof require !== 'undefined' && require.main === module) {
utils.Cleanup(cleanup); // set the cleanup function
logger.exceptions.handle(
new winston.transports.File({
filename: './.log/frontserver-exceptions.log'

Loading…
Cancel
Save