From 826bd5f32377457774b31343adbe70fc0119cd82 Mon Sep 17 00:00:00 2001 From: Leonard Chabot Date: Fri, 27 Oct 2023 17:28:54 +0200 Subject: [PATCH] :bug: Fixed oblique path errors --- src/Common/Utils.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Common/Utils.js b/src/Common/Utils.js index ac2c8a6..9b83bd7 100644 --- a/src/Common/Utils.js +++ b/src/Common/Utils.js @@ -1,22 +1,23 @@ import fs from 'fs' import * as path from 'path' -function listFilesRecursively (directory) { +function listFilesRecursively(directory) { let fileList = [] for (const element of directory) { - const fullPath = path.join(element) - const stats = fs.statSync(fullPath) + const fullPath = path.join(element).replace(/\\/g, '/'); + const stats = fs.statSync(fullPath); if (stats.isDirectory()) { - fileList = fileList.concat(listFilesRecursively(fs.readdirSync(fullPath).map(file => path.join(fullPath, file)))) + fileList = fileList.concat(listFilesRecursively(fs.readdirSync(fullPath).map(file => (path.join(fullPath, file)).replace(/\\/g, '/'))); } else if (stats.isFile()) { - fileList.push(fullPath) + fileList.push(fullPath); } } - return fileList + return fileList; } + function calculateBitrate (bytesDownloaded, downloadTimeSeconds) { // Calculate the bitrate in bytes per second const bytesPerSecond = bytesDownloaded / downloadTimeSeconds