43 lines
747 B
C++
43 lines
747 B
C++
#ifndef PIDIR_H
|
|
#define PIDIR_H
|
|
|
|
#include "pifile.h"
|
|
#include <sys/dir.h>
|
|
|
|
class PIDir
|
|
{
|
|
public:
|
|
PIDir() {dir_ = 0;}
|
|
PIDir(const PIString & dir);
|
|
~PIDir() {close();}
|
|
|
|
inline const bool isExists() {return (dir_ != 0);}
|
|
inline PIString path() {return PIString(path_);}
|
|
PIString absolutePath();
|
|
|
|
bool operator ==(const PIDir & d) const;
|
|
|
|
#ifdef WINDOWS
|
|
static const char separator = '\\';
|
|
#else
|
|
static const char separator = '/';
|
|
#endif
|
|
|
|
static PIDir current();
|
|
static PIDir home();
|
|
static PIDir temporary();
|
|
static bool mkDir(const PIString & path);
|
|
static bool rmDir(const PIString & path);
|
|
//static bool rmDir(const PIString & path);
|
|
|
|
private:
|
|
bool open();
|
|
bool close();
|
|
|
|
string path_;
|
|
DIR * dir_;
|
|
|
|
};
|
|
|
|
#endif // PIDIR_H
|