- add missed files
This commit is contained in:
parent
b690694e58
commit
1960b7aaf1
|
|
@ -0,0 +1,31 @@
|
|||
#include "HL_File.h"
|
||||
#include <fstream>
|
||||
|
||||
bool FileHelper::exists(const std::string& s)
|
||||
{
|
||||
std::ifstream ifs(s);
|
||||
return !ifs.bad();
|
||||
}
|
||||
|
||||
bool FileHelper::exists(const char* s)
|
||||
{
|
||||
return exists(std::string(s));
|
||||
}
|
||||
|
||||
void FileHelper::remove(const std::string& s)
|
||||
{
|
||||
::remove(s.c_str());
|
||||
}
|
||||
|
||||
void FileHelper::remove(const char* s)
|
||||
{
|
||||
::remove(s);
|
||||
}
|
||||
|
||||
std::string FileHelper::gettempname()
|
||||
{
|
||||
char buffer[L_tmpnam];
|
||||
tmpnam(buffer);
|
||||
|
||||
return buffer;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef __HL_FILE_H
|
||||
#define __HL_FILE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class FileHelper
|
||||
{
|
||||
public:
|
||||
static bool exists(const std::string& s);
|
||||
static bool exists(const char* s);
|
||||
|
||||
static void remove(const std::string& s);
|
||||
static void remove(const char* s);
|
||||
|
||||
static std::string gettempname();
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Reference in New Issue