mirror of https://github.com/libAthena/athena.git
Added native wstring fileSize method for Win32
This commit is contained in:
parent
3dbc746ddd
commit
87013ab673
|
@ -208,6 +208,9 @@ std::string& rtrim(std::string& s);
|
||||||
// trim from both ends
|
// trim from both ends
|
||||||
std::string& trim(std::string& s);
|
std::string& trim(std::string& s);
|
||||||
atUint64 fileSize(const std::string& filename);
|
atUint64 fileSize(const std::string& filename);
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
atUint64 fileSize(const std::wstring& filename);
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string wideToUtf8(const std::wstring& src);
|
std::string wideToUtf8(const std::wstring& src);
|
||||||
|
|
||||||
|
|
|
@ -155,11 +155,7 @@ atUint64 FileReader::length() const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if _WIN32
|
|
||||||
return utility::fileSize(utility::wideToUtf8(m_filename));
|
|
||||||
#else
|
|
||||||
return utility::fileSize(m_filename);
|
return utility::fileSize(m_filename);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
atUint64 FileReader::readUBytesToBuf(void* buf, atUint64 len)
|
atUint64 FileReader::readUBytesToBuf(void* buf, atUint64 len)
|
||||||
|
|
|
@ -111,11 +111,7 @@ atUint64 FileWriter::position() const
|
||||||
|
|
||||||
atUint64 FileWriter::length() const
|
atUint64 FileWriter::length() const
|
||||||
{
|
{
|
||||||
#if _WIN32
|
|
||||||
return utility::fileSize(utility::wideToUtf8(m_filename));
|
|
||||||
#else
|
|
||||||
return utility::fileSize(m_filename);
|
return utility::fileSize(m_filename);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileWriter::writeUBytes(const atUint8* data, atUint64 len)
|
void FileWriter::writeUBytes(const atUint8* data, atUint64 len)
|
||||||
|
|
|
@ -171,6 +171,15 @@ atUint64 fileSize(const std::string& filename)
|
||||||
return st.st_size;
|
return st.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
atUint64 fileSize(const std::wstring& filename)
|
||||||
|
{
|
||||||
|
stat64_t st;
|
||||||
|
_wstati64(filename.c_str(), &st);
|
||||||
|
return st.st_size;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// trim from both ends
|
// trim from both ends
|
||||||
std::string& trim(std::string& s)
|
std::string& trim(std::string& s)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue