From ff7baaac3b6ffe763e41c82efddd2ac4eb9afc6f Mon Sep 17 00:00:00 2001 From: Tropical <42101043+tropicaaal@users.noreply.github.com> Date: Fri, 10 Apr 2026 17:04:46 -0500 Subject: [PATCH] nuke non-portable Windows file operations --- targets/java/src/InputOutputStream/FileInputStream.cpp | 4 ---- targets/java/src/InputOutputStream/FileOutputStream.cpp | 4 ---- .../minecraft/world/level/chunk/storage/NbtSlotFile.cpp | 7 ------- targets/minecraft/world/level/chunk/storage/ZoneFile.cpp | 7 ------- 4 files changed, 22 deletions(-) diff --git a/targets/java/src/InputOutputStream/FileInputStream.cpp b/targets/java/src/InputOutputStream/FileInputStream.cpp index 1522fdb58..a6d8d93a7 100644 --- a/targets/java/src/InputOutputStream/FileInputStream.cpp +++ b/targets/java/src/InputOutputStream/FileInputStream.cpp @@ -49,13 +49,9 @@ bool FileSeek(std::FILE* file, int64_t offset, int origin) { // SecurityException - if a security manager exists and its checkRead method // denies read access to the file. FileInputStream::FileInputStream(const File& file) : m_fileHandle(nullptr) { -#if defined(_WIN32) - m_fileHandle = _wfopen(file.getPath().c_str(), "rb"); -#else const std::string nativePath = std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "rb"); -#endif if (m_fileHandle == nullptr) { assert(0); diff --git a/targets/java/src/InputOutputStream/FileOutputStream.cpp b/targets/java/src/InputOutputStream/FileOutputStream.cpp index 82db3bbac..ae8971a52 100644 --- a/targets/java/src/InputOutputStream/FileOutputStream.cpp +++ b/targets/java/src/InputOutputStream/FileOutputStream.cpp @@ -26,13 +26,9 @@ FileOutputStream::FileOutputStream(const File& file) : m_fileHandle(nullptr) { return; } -#if defined(_WIN32) - m_fileHandle = _wfopen(file.getPath().c_str(), "wb"); -#else const std::string nativePath = std::filesystem::path(file.getPath()).string(); m_fileHandle = std::fopen(nativePath.c_str(), "wb"); -#endif if (m_fileHandle == nullptr) { // TODO 4J Stu - Any form of error/exception handling diff --git a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp index 325ba6ced..651032e1b 100644 --- a/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/NbtSlotFile.cpp @@ -6,19 +6,12 @@ namespace { std::FILE* OpenBinaryFileForReadWrite(const File& file) { -#if defined(_WIN32) - std::FILE* stream = _wfopen(file.getPath().c_str(), "r+b"); - if (stream == nullptr) { - stream = _wfopen(file.getPath().c_str(), "w+b"); - } -#else const std::string nativePath = std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); } -#endif return stream; } diff --git a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp index cbf5e30ed..43ed2cece 100644 --- a/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp +++ b/targets/minecraft/world/level/chunk/storage/ZoneFile.cpp @@ -7,19 +7,12 @@ namespace { std::FILE* OpenBinaryFileForReadWrite(const File& file) { -#if defined(_WIN32) - std::FILE* stream = _wfopen(file.getPath().c_str(), "r+b"); - if (stream == nullptr) { - stream = _wfopen(file.getPath().c_str(), "w+b"); - } -#else const std::string nativePath = std::filesystem::path(file.getPath()).string(); std::FILE* stream = std::fopen(nativePath.c_str(), "r+b"); if (stream == nullptr) { stream = std::fopen(nativePath.c_str(), "w+b"); } -#endif return stream; } } // namespace