mirror of
https://github.com/libAthena/athena.git
synced 2025-12-14 07:36:14 +00:00
* Fix Wii/GC Compiling
* Initial FileInfo/Dir APIs * Get rid of type punning warnings
This commit is contained in:
59
include/Athena/FileInfo.hpp
Normal file
59
include/Athena/FileInfo.hpp
Normal file
@@ -0,0 +1,59 @@
|
||||
#ifndef FILEINFO_HPP
|
||||
#define FILEINFO_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "Athena/Global.hpp"
|
||||
|
||||
namespace Athena
|
||||
{
|
||||
class FileInfo
|
||||
{
|
||||
public:
|
||||
explicit FileInfo(const std::string& path = std::string());
|
||||
|
||||
std::string absolutePath() const;
|
||||
static inline std::string absolutePath(const std::string& lnk)
|
||||
{ return FileInfo(lnk).absolutePath(); }
|
||||
|
||||
std::string absoluteFilePath() const;
|
||||
static inline std::string absoluteFilePath(const std::string& path)
|
||||
{ return FileInfo(path).absoluteFilePath(); }
|
||||
|
||||
std::string filename() const;
|
||||
static inline std::string filename(const std::string path)
|
||||
{ return FileInfo(path).filename(); }
|
||||
|
||||
std::string path() const;
|
||||
static inline std::string path(const std::string path)
|
||||
{ return FileInfo(path).path(); }
|
||||
|
||||
std::string extension() const;
|
||||
static inline std::string extension(const std::string path)
|
||||
{ return FileInfo(path).extension(); }
|
||||
|
||||
atUint64 size() const;
|
||||
static inline atUint64 size(const std::string path)
|
||||
{ return FileInfo(path).size(); }
|
||||
|
||||
bool exists() const;
|
||||
static inline bool exists(const std::string& path)
|
||||
{ return FileInfo(path).exists(); }
|
||||
|
||||
bool isLink() const;
|
||||
static inline bool isLink(const std::string& lnk)
|
||||
{ return FileInfo(lnk).isLink(); }
|
||||
bool isFile() const;
|
||||
static inline bool isFile(const std::string& path)
|
||||
{ return FileInfo(path).isFile(); }
|
||||
|
||||
bool touch() const;
|
||||
static inline bool touch(const std::string& path)
|
||||
{ return FileInfo(path).touch(); }
|
||||
|
||||
private:
|
||||
std::string m_path;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // FILEINFO_HPP
|
||||
Reference in New Issue
Block a user