From 64c47118d801b73f963fdd4d76d4b936ac3fdf9b Mon Sep 17 00:00:00 2001 From: nastys <@> Date: Wed, 11 Aug 2021 20:07:24 +0200 Subject: [PATCH] Exclude macOS metadata --- source-code/source/PD-Loader/Patches/patches.cpp | 2 ++ source-code/source/PD-Loader/dllmain.cpp | 2 ++ source-code/source/plugins/Launcher/framework.h | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/source-code/source/PD-Loader/Patches/patches.cpp b/source-code/source/PD-Loader/Patches/patches.cpp index 35574db..5385253 100644 --- a/source-code/source/PD-Loader/Patches/patches.cpp +++ b/source-code/source/PD-Loader/Patches/patches.cpp @@ -64,6 +64,8 @@ void ApplyAllCustomPatches() try { for (std::filesystem::path p : std::filesystem::directory_iterator("patches")) { + if (std::filesystem::path(p).filename().string()._Starts_with("._")) continue; // exclude macOS metadata + std::string extension = std::filesystem::path(p).extension().string(); if ((extension == ".p" || extension == ".P" || extension == ".p2" || extension == ".P2")) { diff --git a/source-code/source/PD-Loader/dllmain.cpp b/source-code/source/PD-Loader/dllmain.cpp index 09980dc..6154ea8 100644 --- a/source-code/source/PD-Loader/dllmain.cpp +++ b/source-code/source/PD-Loader/dllmain.cpp @@ -220,6 +220,8 @@ void FindFiles(WIN32_FIND_DATAW* fd) do { if (!(fd->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + if (fd->cFileName[0] == '.' && fd->cFileName[1] == '_') continue; // exclude macOS metadata + if (!_wcsicmp(fd->cFileName, L"Patches.dva") || !_wcsicmp(fd->cFileName, L"Render.dva")) { DeleteFileW(fd->cFileName); diff --git a/source-code/source/plugins/Launcher/framework.h b/source-code/source/plugins/Launcher/framework.h index 0b69598..dc0f7bf 100644 --- a/source-code/source/plugins/Launcher/framework.h +++ b/source-code/source/plugins/Launcher/framework.h @@ -425,6 +425,8 @@ std::vector LoadPlugins() do { if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + if (ffd.cFileName[0] == '.' && ffd.cFileName[1] == '_') continue; // exclude macOS metadata + auto pos = wcslen(ffd.cFileName); if (ffd.cFileName[pos - 4] == '.' && @@ -509,6 +511,8 @@ std::vector LoadCustom() do { if (!(ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { + if (ffd.cFileName[0] == '.' && ffd.cFileName[1] == '_') continue; // exclude macOS metadata + auto pos = wcslen(ffd.cFileName); if ((ffd.cFileName[pos - 2] == '.' && (ffd.cFileName[pos - 1] == 'p' || ffd.cFileName[pos - 1] == 'P')) ||