mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-13 11:11:59 +00:00
refactor: consolidate file I/O into IPlatformFileIO, delete PortableFileIO and PathHelper
This commit is contained in:
@@ -10,7 +10,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "console_helpers/StringHelpers.h"
|
||||
#include <filesystem>
|
||||
|
||||
#include "java/File.h"
|
||||
|
||||
namespace {
|
||||
@@ -52,7 +53,7 @@ FileInputStream::FileInputStream(const File& file) : m_fileHandle(nullptr) {
|
||||
#if defined(_WIN32)
|
||||
m_fileHandle = _wfopen(file.getPath().c_str(), L"rb");
|
||||
#else
|
||||
const std::string nativePath = wstringtofilename(file.getPath());
|
||||
const std::string nativePath = std::filesystem::path(file.getPath()).string();
|
||||
m_fileHandle = std::fopen(nativePath.c_str(), "rb");
|
||||
#endif
|
||||
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "console_helpers/StringHelpers.h" // 4jcraft TODO
|
||||
#include <filesystem>
|
||||
|
||||
#include "java/File.h"
|
||||
|
||||
// Creates a file output stream to write to the file represented by the
|
||||
@@ -29,7 +30,7 @@ FileOutputStream::FileOutputStream(const File& file) : m_fileHandle(nullptr) {
|
||||
#if defined(_WIN32)
|
||||
m_fileHandle = _wfopen(file.getPath().c_str(), L"wb");
|
||||
#else
|
||||
const std::string nativePath = wstringtofilename(file.getPath());
|
||||
const std::string nativePath = std::filesystem::path(file.getPath()).string();
|
||||
m_fileHandle = std::fopen(nativePath.c_str(), "wb");
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user