fix: Read absolute path of symlinks (#90)

This commit is contained in:
slowsage 2023-08-19 17:28:55 -04:00 committed by GitHub
parent e498c438b1
commit 5e73eb6055
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -123,7 +123,9 @@ void CHyprpaper::preloadAllWallpapersFromConfig() {
m_mWallpaperTargets[wp] = CWallpaperTarget(); m_mWallpaperTargets[wp] = CWallpaperTarget();
if (std::filesystem::is_symlink(wp)) { if (std::filesystem::is_symlink(wp)) {
auto real_wp = std::filesystem::read_symlink(wp); auto real_wp = std::filesystem::read_symlink(wp);
m_mWallpaperTargets[wp].create(real_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 { } else {
m_mWallpaperTargets[wp].create(wp); m_mWallpaperTargets[wp].create(wp);
} }