aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRachel Powers <508861+Ryex@users.noreply.github.com>2023-02-10 06:49:52 -0700
committerRachel Powers <508861+Ryex@users.noreply.github.com>2023-03-20 14:56:32 -0700
commit1210c3256d20133cc793b2a5b4f22f02e6519818 (patch)
tree0bd7cc17628604aa75518fcd075375361d5fa03f
parent2e8d04aad0d4fe3e742e4b29f4e23dc91b8ef838 (diff)
downloadPrismLauncher-1210c3256d20133cc793b2a5b4f22f02e6519818.tar.gz
PrismLauncher-1210c3256d20133cc793b2a5b4f22f02e6519818.tar.bz2
PrismLauncher-1210c3256d20133cc793b2a5b4f22f02e6519818.zip
fix: macos compat after refactor of `clonefile`
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
-rw-r--r--launcher/FileSystem.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/launcher/FileSystem.cpp b/launcher/FileSystem.cpp
index 4037d346..69e2d36a 100644
--- a/launcher/FileSystem.cpp
+++ b/launcher/FileSystem.cpp
@@ -1191,6 +1191,7 @@ bool winbtrfs_clone(const std::wstring& src_path, const std::wstring& dst_path,
bool refs_clone(const std::wstring& src_path, const std::wstring& dst_path, std::error_code& ec)
{
+#if defined(FSCTL_DUPLICATE_EXTENTS_TO_FILE)
//https://learn.microsoft.com/en-us/windows/win32/api/winioctl/ni-winioctl-fsctl_duplicate_extents_to_file
//https://github.com/microsoft/CopyOnWrite/blob/main/lib/Windows/WindowsCopyOnWriteFilesystem.cs#L94
std::wstring existingFile = src_path.c_str();
@@ -1220,7 +1221,11 @@ bool refs_clone(const std::wstring& src_path, const std::wstring& dst_path, std:
CloseHandle(hExistingFile);
return (result != 0);
-
+#else
+ ec = std::make_error_code(std::errc::not_supported);
+ qWarning() << "not built with refs support";
+ return false;
+#endif
}
@@ -1270,7 +1275,7 @@ bool macos_bsd_clonefile(const std::string& src_path, const std::string& dst_pat
// clonefile(const char * src, const char * dst, int flags);
// https://www.manpagez.com/man/2/clonefile/
- qDebug() << "attempting file clone via clonefile" << src << "to" << dst;
+ qDebug() << "attempting file clone via clonefile" << src_path.c_str() << "to" << dst_path.c_str();
if (clonefile(src_path.c_str(), dst_path.c_str(), 0) == -1) {
qWarning() << "Failed to clone file:" << src_path.c_str() << "to" << dst_path.c_str();
qDebug() << "Error:" << strerror(errno);