From 7a41281993abf76b35042e2119d387e7604871ef Mon Sep 17 00:00:00 2001
From: mrfry <mrfry@airmail.cc>
Date: Mon, 9 Nov 2020 18:05:33 +0100
Subject: [PATCH] Changed short variable names to something longer

---
 src/utils/readme.md |  1 -
 src/utils/utils.js  | 51 +++++++++++++++++++--------------------------
 2 files changed, 21 insertions(+), 31 deletions(-)

diff --git a/src/utils/readme.md b/src/utils/readme.md
index 6ddd567..185e0bf 100644
--- a/src/utils/readme.md
+++ b/src/utils/readme.md
@@ -41,7 +41,6 @@ Exportált funkciók:
 2. WriteFile
 3. writeFileAsync
 4. AppendToFile
-5. Beep
 6. WriteBackup
 7. FileExists
 8. CreatePath
diff --git a/src/utils/utils.js b/src/utils/utils.js
index b566982..58886ee 100755
--- a/src/utils/utils.js
+++ b/src/utils/utils.js
@@ -4,7 +4,6 @@ module.exports = {
   WriteFile: WriteFile,
   writeFileAsync: WriteFileAsync,
   AppendToFile: AppendToFile,
-  Beep: Beep,
   WriteBackup: WriteBackup,
   FileExists: FileExists,
   CreatePath: CreatePath,
@@ -21,19 +20,19 @@ var logger = require('../utils/logger.js')
 const dataFile = './qminingPublic/data.json'
 
 function GetDateString() {
-  const m = new Date()
+  const date = new Date()
   return (
-    m.getFullYear() +
+    date.getFullYear() +
     '-' +
-    ('0' + (m.getMonth() + 1)).slice(-2) +
+    ('0' + (date.getMonth() + 1)).slice(-2) +
     '-' +
-    ('0' + m.getDate()).slice(-2) +
+    ('0' + date.getDate()).slice(-2) +
     ' ' +
-    ('0' + m.getHours()).slice(-2) +
+    ('0' + date.getHours()).slice(-2) +
     ':' +
-    ('0' + m.getMinutes()).slice(-2) +
+    ('0' + date.getMinutes()).slice(-2) +
     ':' +
-    ('0' + m.getSeconds()).slice(-2)
+    ('0' + date.getSeconds()).slice(-2)
   )
 }
 
@@ -49,8 +48,8 @@ function ReadDir(path) {
 function ReadJSON(name) {
   try {
     return JSON.parse(ReadFile(name))
-  } catch (e) {
-    console.log(e)
+  } catch (err) {
+    console.error(err)
     throw new Error('Coulndt parse JSON in "ReadJSON", file: ' + name)
   }
 }
@@ -68,7 +67,7 @@ function FileExists(path) {
 
 function WatchFile(file, callback) {
   if (FileExists(file)) {
-    fs.watchFile(file, (curr, prev) => {
+    fs.watchFile(file, () => {
       fs.readFile(file, 'utf8', (err, data) => {
         if (err) {
           // console.log(err)
@@ -90,20 +89,20 @@ function CreatePath(path, onlyPath) {
     return
   }
 
-  var p = path.split('/')
-  var currDir = p[0]
-  for (var i = 1; i < p.length; i++) {
+  var spath = path.split('/')
+  var currDir = spath[0]
+  for (var i = 1; i < spath.length; i++) {
     if (currDir !== '' && !fs.existsSync(currDir)) {
       try {
         fs.mkdirSync(currDir)
-      } catch (e) {
+      } catch (err) {
         console.log('Failed to make ' + currDir + ' directory... ')
+        console.error(err)
       }
     }
-    currDir += '/' + p[i]
+    currDir += '/' + spath[i]
   }
-  if (onlyPath === undefined || onlyPath === false) {
-  } else {
+  if (onlyPath) {
     fs.mkdirSync(path)
   }
 }
@@ -129,21 +128,13 @@ function AppendToFile(data, file) {
   CreatePath(file)
   try {
     fs.appendFileSync(file, '\n' + data)
-  } catch (e) {
+  } catch (err) {
     logger.Log(
       'Error appendig to file log file: ' + file + ' (sync)',
       logger.GetColor('redbg')
     )
     logger.Log(data)
-    console.log(e)
-  }
-}
-
-function Beep() {
-  try {
-    process.stdout.write('\x07')
-  } catch (e) {
-    console.log('error beepin')
+    console.error(err)
   }
 }
 
@@ -153,8 +144,8 @@ function WriteBackup() {
       ReadFile(dataFile),
       'public/backs/data_' + new Date().toString()
     )
-  } catch (e) {
+  } catch (err) {
     logger.Log('Error backing up data json file!', logger.GetColor('redbg'))
-    console.log(e)
+    console.error(err)
   }
 }