diff --git a/README.md b/README.md index d5f339ba6..ec85793dc 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ For **Users** : > [!IMPORTANT] > - To download files in your local directory, you need to pass that directory as a volume to Drifty. > Suppose, you want to download the file in your `home/username/Downloads` directory, then, the volume flag that you need to pass to docker will be `-v /home/username/Downloads:/root/Downloads`. -> - You can pass `-v /home/username/.drifty:/root/.config` to enable the docker container to store the Drifty's data in your local directory, making initialization of Drifty much faster 🚀. +> - You can pass `-v /home/username/.drifty:/root/.drifty` to enable the docker container to store the Drifty's data in your local directory, making initialization of Drifty much faster 🚀. > - For **Linux**, it is advisable to use **Docker Engine** directly instead of running images using **Docker Desktop**. You can do the same by adding **_`sudo`_** before the docker commands. 1. Pull the Docker image for Drifty using the below command - diff --git a/docker-compose.yaml b/docker-compose.yaml index f0a886058..b6325a12e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -23,7 +23,7 @@ services: container_name: drifty-cli volumes: - ${DOWNLOAD_FOLDER:-.}:/root/Downloads - - ./.drifty:/root/.config + - ./.drifty:/root/.drifty gui: depends_on: - base @@ -39,4 +39,4 @@ services: volumes: - ${DOWNLOAD_FOLDER:-.}:/root/Downloads - /tmp/.X11-unix:/tmp/.X11-unix - - ./.drifty:/root/.config + - ./.drifty:/root/.drifty diff --git a/src/main/java/Utils/Environment.java b/src/main/java/Utils/Environment.java index 6b673e80d..e1ac57768 100644 --- a/src/main/java/Utils/Environment.java +++ b/src/main/java/Utils/Environment.java @@ -23,16 +23,16 @@ public class Environment { */ public static void initializeEnvironment() { M.msgLogInfo("OS : " + OS.getOSName()); - String ytDLP = OS.isWindows() ? "yt-dlp.exe" : OS.isMac() ? "yt-dlp_macos" : "yt-dlp"; - String spotdl = OS.isWindows() ? "spotdl_win.exe" : OS.isMac() ? "spotdl_macos" : "spotdl_linux"; - String appUseFolderPath = OS.isWindows() ? Paths.get(System.getenv("LOCALAPPDATA"), "Drifty").toAbsolutePath().toString() : Paths.get(System.getProperty("user.home"), ".config", "Drifty").toAbsolutePath().toString(); - Program.setYt_DlpExecutableName(ytDLP); - Program.setSpotdlExecutableName(spotdl); - Program.setDriftyPath(appUseFolderPath); + String ytDlpExecName = OS.isWindows() ? "yt-dlp.exe" : OS.isMac() ? "yt-dlp_macos" : "yt-dlp"; + String spotDLExecName = OS.isWindows() ? "spotdl_win.exe" : OS.isMac() ? "spotdl_macos" : "spotdl_linux"; + String driftyFolderPath = OS.isWindows() ? Paths.get(System.getenv("LOCALAPPDATA"), "Drifty").toAbsolutePath().toString() : Paths.get(System.getProperty("user.home"), ".drifty").toAbsolutePath().toString(); + Program.setYt_DlpExecutableName(ytDlpExecName); + Program.setSpotdlExecutableName(spotDLExecName); + Program.setDriftyPath(driftyFolderPath); CopyExecutables copyExecutables = new CopyExecutables(); boolean ytDLPExists = false; try { - copyExecutables.copyExecutables(new String[]{ytDLP, spotdl}); + copyExecutables.copyExecutables(new String[]{ytDlpExecName, spotDLExecName}); } catch (IOException e) { M.msgInitError("Failed to copy yt-dlp! " + e.getMessage()); M.msgInitError("Failed to copy spotDL! " + e.getMessage()); @@ -40,16 +40,16 @@ public static void initializeEnvironment() { if (ytDLPExists && !isYtDLPUpdated()) { updateYt_dlp(); } - File folder = new File(appUseFolderPath); + File folder = new File(driftyFolderPath); if (!folder.exists()) { try { Files.createDirectory(folder.toPath()); - M.msgInitInfo("Created Drifty folder : " + appUseFolderPath); + M.msgInitInfo("Created Drifty folder : " + driftyFolderPath); } catch (IOException e) { - M.msgInitError("Failed to create Drifty folder: " + appUseFolderPath + " - " + e.getMessage()); + M.msgInitError("Failed to create Drifty folder: " + driftyFolderPath + " - " + e.getMessage()); } } else { - M.msgInitInfo("Drifty folder already exists : " + appUseFolderPath); + M.msgInitInfo("Drifty folder already exists : " + driftyFolderPath); } } @@ -77,6 +77,7 @@ public static boolean isYtDLPUpdated() { long timeSinceLastUpdate = System.currentTimeMillis() - AppSettings.get.lastDLPUpdateTime(); return timeSinceLastUpdate <= oneDay; } + public static MessageBroker getMessageBroker() { return M; }