Browse Source

make windows work

Signed-off-by: crueter <crueter@eden-emu.dev>
pull/2815/head
crueter 3 months ago
parent
commit
5867a1a1f9
  1. 6
      src/common/fs/symlink.cpp
  2. 4
      src/qt_common/util/fs.cpp

6
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 <iostream>
#include "symlink.h"
#ifdef _WIN32
#include <winbase.h>
#include <windows.h>
#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

4
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"),

Loading…
Cancel
Save