mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-06-08 18:46:36 +00:00
nuke non-portable Windows file operations
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user