From 5867a1a1f988e4ccc603f35bf2facd1babb18d8f Mon Sep 17 00:00:00 2001 From: crueter Date: Sun, 26 Oct 2025 23:00:29 -0700 Subject: [PATCH] make windows work Signed-off-by: crueter --- src/common/fs/symlink.cpp | 6 ++++-- src/qt_common/util/fs.cpp | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/common/fs/symlink.cpp b/src/common/fs/symlink.cpp index d488fd4771..905bc5018d 100644 --- a/src/common/fs/symlink.cpp +++ b/src/common/fs/symlink.cpp @@ -1,10 +1,11 @@ // SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later +#include #include "symlink.h" #ifdef _WIN32 -#include +#include #endif namespace fs = std::filesystem; @@ -34,7 +35,8 @@ bool CreateSymlink(const fs::path &from, const fs::path &to) bool IsSymlink(const fs::path &path) { #ifdef _WIN32 - return fs::status(path).type() == fs::file_type::junction; + auto attributes = GetFileAttributesW(path.wstring().c_str()); + return attributes & FILE_ATTRIBUTE_REPARSE_POINT; #else return fs::is_symlink(path); #endif diff --git a/src/qt_common/util/fs.cpp b/src/qt_common/util/fs.cpp index a966f7ea90..da59a4e675 100644 --- a/src/qt_common/util/fs.cpp +++ b/src/qt_common/util/fs.cpp @@ -58,7 +58,9 @@ bool CheckUnlink(const fs::path &eden_dir, const fs::path &ryu_dir) // first cleanup the symlink/junction, try { - fs::remove_all(linked); + // NB: do NOT use remove_all, as Windows treats this as a remove_all to the target, + // NOT the junction + fs::remove(linked); } catch (std::exception &e) { QtCommon::Frontend::Critical( tr("Failed to unlink old directory"),