Fix: Centralize resource paths and icons

This commit is contained in:
MasterAcnolo
2026-02-17 21:28:46 +01:00
parent 334e83ae1f
commit 760550e521
3 changed files with 51 additions and 25 deletions

View File

@@ -5,11 +5,17 @@ const config = require("../../config");
const { logger } = require("../logger.js");
// Centralisation de tous les chemins de ressources
const resourcesPath = config.localMode
? path.join(__dirname, "../../ressources")
: process.resourcesPath;
// Chemins des binaires
let userYtDlp;
let ffmpegPath;
let denoPath;
const sourceYtDlp = path.join(process.resourcesPath, "binaries","yt-dlp.exe");
const sourceYtDlp = path.join(resourcesPath, "binaries","yt-dlp.exe");
if (config.localMode) {
userYtDlp = path.join(__dirname, "../../ressources/yt-dlp.exe");
@@ -17,8 +23,8 @@ if (config.localMode) {
denoPath = path.join(__dirname, "../../ressources/deno.exe");
} else {
userYtDlp = path.join(app.getPath("userData"),"yt-dlp.exe");
ffmpegPath = path.join(process.resourcesPath, "binaries","ffmpeg.exe");
denoPath = path.join(process.resourcesPath, "binaries","deno.exe");
ffmpegPath = path.join(resourcesPath, "binaries","ffmpeg.exe");
denoPath = path.join(resourcesPath, "binaries","deno.exe");
if (!fs.existsSync(userYtDlp)) {
fs.copyFileSync(sourceYtDlp, userYtDlp);
@@ -26,8 +32,23 @@ if (config.localMode) {
}
// Chemins des icônes de notification
const iconPaths = {
confirm: path.join(resourcesPath, "confirm-icon.png"),
error: path.join(resourcesPath, "error.png"),
app: path.join(resourcesPath, "app-icon.ico")
};
// Chemins des binaires pour vérification
const binaryPaths = {
ytDlp: path.join(resourcesPath, "binaries", "yt-dlp.exe"),
ffmpeg: path.join(resourcesPath, "binaries", "ffmpeg.exe"),
ffprobe: path.join(resourcesPath, "binaries", "ffprobe.exe"),
deno: path.join(resourcesPath, "binaries", "deno.exe")
};
if (!userYtDlp){ logger.error("Missing YT-DLP")}
if (!ffmpegPath){ logger.error("Missing FFMPEG")}
if (!denoPath){ logger.error("Missing DENO")}
module.exports = { userYtDlp, ffmpegPath, denoPath };
module.exports = { userYtDlp, ffmpegPath, denoPath, iconPaths, binaryPaths, resourcesPath };