[DEV] other

This commit is contained in:
Edouard DUPIN 2018-10-23 22:10:43 +02:00
parent 669fb6968d
commit 55a4e4b5f2
5 changed files with 17 additions and 1 deletions

View File

@ -33,7 +33,7 @@ void operator delete[] (void* ptr) {
#define ETK_MEM_DEBUG_LEVEL 5
#define ETK_MEM_DEBUG_LEVEL 4
#define ETK_MEMORY_PRINT(...) \
do { \
@ -768,6 +768,14 @@ void* etk::memory::allocate(size_t _num,
const char* _functionName,
int32_t _line,
const char* _fileName) {
/*
if ( (_num * _size ) > 100*1024*1024) {
printf("-------------------------------------------------------------------------------------------\n");
printf("== %s:%d %s %s\n", _fileName, _fileName, _functionName, _variableName);
printf("-------------------------------------------------------------------------------------------\n");
assert(false);
}
*/
return getHandle().allocate(_num, _size, _variableName, _functionName, _line, _fileName);
}

View File

@ -34,6 +34,7 @@ static const ColorList* getColorList();
etk::Color<uint8_t, 4> etk::parseStringStartWithSharp(const etk::String& _input) {
TK_VERBOSE("parseStringStartWithSharp('" << _input << "'");
//elog::displayBacktrace(false, 0);
size_t len = _input.size();
etk::Color<uint8_t, 4> outputValue(0,0,0,0);
if(len == 3) {

View File

@ -39,6 +39,9 @@ bool etk::io::File::open(etk::io::OpenMode _mode) {
m_pointer = fopen(m_path.getNative().c_str(), "rb");
break;
case etk::io::OpenMode::Write:
if (etk::path::isDirectory(m_path.getParent().getNative()) == false) {
etk::path::makeDirectories(m_path.getParent().getNative());
}
m_pointer = fopen(m_path.getNative().c_str(), "wb");
break;
case etk::io::OpenMode::Append:

View File

@ -26,6 +26,9 @@ namespace etk {
ETK_CONSTRUCTOR_COPY_DELETE(File);
ETK_CONSTRUCTOR_MOVE_DEFAULT(File);
public:
const etk::Path& getPath() {
return m_path;
}
bool open(etk::io::OpenMode _mode) override;
bool isOpen() override;
bool close() override;

View File

@ -126,6 +126,7 @@ namespace etk {
bool exist(const etk::Path& _path);
/**
* @brief Get the File size
* @param[in] _path Path of the file
* @return the requested size
*/
uint64_t fileSize(const etk::Path& _path);