Add HECL::Rename

This commit is contained in:
Jack Andersen 2016-01-04 14:00:34 -10:00
parent 5c1551bf08
commit e2c42b208c
2 changed files with 22 additions and 1 deletions

2
hecl/extern/Athena vendored

@ -1 +1 @@
Subproject commit 9c880813acba16bd36a81320c29f6b57d933ba83
Subproject commit cf3739fcedf9e58bcb11efd25b183a42739c29e6

View File

@ -300,6 +300,15 @@ static inline FILE* Fopen(const SystemChar* path, const SystemChar* mode, FileLo
return fp;
}
static inline int Rename(const SystemChar* oldpath, const SystemChar* newpath)
{
#if HECL_UCS2
return _wrename(oldpath, newpath);
#else
return rename(oldpath, newpath);
#endif
}
static inline int Stat(const SystemChar* path, Sstat* statOut)
{
#if HECL_UCS2
@ -664,6 +673,18 @@ public:
Hash hash() const {return m_hash;}
bool operator==(const ProjectRootPath& other) const {return m_hash == other.m_hash;}
bool operator!=(const ProjectRootPath& other) const {return m_hash != other.m_hash;}
/**
* @brief Obtain c-string of final path component
* @return Final component c-string (may be empty)
*/
const SystemChar* getLastComponent() const
{
size_t pos = m_projRoot.rfind(_S('/'));
if (pos == SystemString::npos)
return m_projRoot.c_str() + m_projRoot.size();
return m_projRoot.c_str() + pos + 1;
}
};
/**