<commit_before>#include "engine/fs/os_file.h"
#include "engine/iallocator.h"
#include "engine/string.h"
#include "engine/lumix.h"
#include <cstdio>
#include <unistd.h>


namespace Lumix
{
namespace FS
{


OsFile::OsFile()
{
	m_handle = nullptr;
}

OsFile::~OsFile()
{
	ASSERT(!m_handle);
}

bool OsFile::open(const char* path, Mode mode, IAllocator& allocator)
{
	m_handle = (void*)fopen(path, Mode::WRITE & mode ? "wb" : "rb");
	return m_handle;
}

void OsFile::flush()
{
	ASSERT(nullptr != m_handle);
	fflush((FILE*)m_handle);
}

void OsFile::close()
{
	if (nullptr != m_handle)
	{
		fclose((FILE*)m_handle);
		m_handle = nullptr;
	}
}

bool OsFile::writeText(const char* text)
{
	int len = stringLength(text);
	return write(text, len);
}

bool OsFile::write(const void* data, size_t size)
{
	ASSERT(nullptr != m_handle);
	size_t written = fwrite(data, size, 1, (FILE*)m_handle);
	return written == 1;<commit_msg>fixed linux build, try #2<commit_after>#include "engine/fs/os_file.h"
#include "engine/iallocator.h"
#include "engine/string.h"
#include "engine/lumix.h"
#include <cstdio>
#include <unistd.h>


namespace Lumix
{
namespace FS
{


OsFile::OsFile()
{
	m_handle = nullptr;
}

OsFile::~OsFile()
{
	ASSERT(!m_handle);
}

bool OsFile::open(const char* path, Mode mode)
{
	m_handle = (void*)fopen(path, Mode::WRITE & mode ? "wb" : "rb");
	return m_handle;
}

void OsFile::flush()
{
	ASSERT(nullptr != m_handle);
	fflush((FILE*)m_handle);
}

void OsFile::close()
{
	if (nullptr != m_handle)
	{
		fclose((FILE*)m_handle);
		m_handle = nullptr;
	}
}

bool OsFile::writeText(const char* text)
{
	int len = stringLength(text);
	return write(text, len);
}

bool OsFile::write(const void* data, size_t size)
{
	ASSERT(nullptr != m_handle);
	size_t written = fwrite(data, size, 1, (FILE*)m_handle);
	return written == 1;
{'fraction_non_alphanumeric': 0.1726223199560198, 'fraction_numerical': 0.002748763056624519, 'mean_word_length': 5.29757785467128, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2952937', 'n_tokens_mistral': 745, 'n_tokens_neox': 732, 'n_words': 155}