From 6a9c77dfad4ae1f07dc83037f5d5bd63e262d360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Thu, 1 Apr 2021 22:31:54 +0200 Subject: [PATCH] Fix file paths in debug messages --- src/fileOps.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/fileOps.js b/src/fileOps.js index 9dc52faa..e5cc839e 100644 --- a/src/fileOps.js +++ b/src/fileOps.js @@ -56,12 +56,14 @@ function createDirPromise(dir) function saveFilePromise(place, subdirName, fileName, data) { return new Promise(async (resolve, reject) => { - let destPath = GLib[`get_${place}_dir`]() + '/' + Misc.appId; + let folderPath = GLib[`get_${place}_dir`]() + '/' + Misc.appId; if(subdirName) - destPath += `/${subdirName}`; + folderPath += `/${subdirName}`; + + const destDir = Gio.File.new_for_path(folderPath); + const destPath = folderPath + '/' + fileName; - const destDir = Gio.File.new_for_path(destPath); debug(`saving file: ${destPath}`); const checkFolders = (subdirName) @@ -90,15 +92,15 @@ function saveFilePromise(place, subdirName, fileName, data) }); } -function getFileContentsPromise(place, folderName, fileName) +function getFileContentsPromise(place, subdirName, fileName) { return new Promise((resolve, reject) => { - const destPath = [ - GLib[`get_${place}_dir`](), - Misc.appId, - folderName, - fileName - ].join('/'); + let destPath = GLib[`get_${place}_dir`]() + '/' + Misc.appId; + + if(subdirName) + destPath += `/${subdirName}`; + + destPath += `/${fileName}`; const file = Gio.File.new_for_path(destPath); debug(`reading data from: ${destPath}`);