-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathLSDFileTools.cpp
More file actions
54 lines (39 loc) · 825 Bytes
/
LSDFileTools.cpp
File metadata and controls
54 lines (39 loc) · 825 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <fstream>
#include <string>
#include <sys/stat.h>
#include "LSDFileTools.hpp"
using namespace std;
#ifndef FileTools_CPP
#define FileTools_CPP
bool DoesFileExist(string filename)
{
bool WellDoesIt = false;
struct stat sb;
if (stat(filename.c_str(), &sb) == 0 && S_ISREG(sb.st_mode))
{
WellDoesIt = true;
}
return WellDoesIt;
}
bool DoesFileExist(string path, string fname)
{
bool WellDoesIt = false;
string filename = path+fname;
struct stat sb;
if (stat(filename.c_str(), &sb) == 0 && S_ISREG(sb.st_mode))
{
WellDoesIt = true;
}
return WellDoesIt;
}
bool DoesDirectoryExist(string dirname)
{
bool WellDoesIt = false;
struct stat sb;
if (stat(dirname.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode))
{
WellDoesIt = true;
}
return WellDoesIt;
}
#endif