From 2b79075feb9a5ec535a08ffe0338872c96bc6a71 Mon Sep 17 00:00:00 2001 From: lch361 Date: Fri, 19 Jan 2024 07:34:20 +0300 Subject: [PATCH] Can preload recursive symlinks now --- src/Hyprpaper.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Hyprpaper.cpp b/src/Hyprpaper.cpp index 34f2720..a45e300 100644 --- a/src/Hyprpaper.cpp +++ b/src/Hyprpaper.cpp @@ -129,14 +129,13 @@ void CHyprpaper::preloadAllWallpapersFromConfig() { continue; m_mWallpaperTargets[wp] = CWallpaperTarget(); - if (std::filesystem::is_symlink(wp)) { - auto real_wp = std::filesystem::read_symlink(wp); - std::filesystem::path absolute_path = std::filesystem::path(wp).parent_path() / real_wp; - absolute_path = absolute_path.lexically_normal(); - m_mWallpaperTargets[wp].create(absolute_path); - } else { - m_mWallpaperTargets[wp].create(wp); + std::filesystem::path create_wp = wp; + while (std::filesystem::is_symlink(create_wp)) { + auto real_wp = std::filesystem::read_symlink(create_wp); + std::filesystem::path absolute_path = std::filesystem::path(create_wp).parent_path() / real_wp; + create_wp = absolute_path.lexically_normal(); } + m_mWallpaperTargets[wp].create(create_wp); } g_pConfigManager->m_dRequestedPreloads.clear();