- add missed files

This commit is contained in:
Dmytro Bogovych 2018-08-29 15:59:55 +03:00
parent b690694e58
commit 1960b7aaf1
2 changed files with 49 additions and 0 deletions

View File

@ -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;
}

View File

@ -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