-
Notifications
You must be signed in to change notification settings - Fork 1
/
osal.hpp
46 lines (39 loc) · 1017 Bytes
/
osal.hpp
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
#pragma once
#include <ctime>
#include <sstream>
#include <string>
#include <vector>
std::string getDirSeparator();
std::string getCurrentWorkingDir();
std::string getExecPath();
std::vector<std::string> getFilesList(const std::string &dirPath);
time_t getFileModification(const std::string &);
bool isDirExist(const std::string &dir);
void exec(const std::string &cmd);
void execShowCmd(const std::string &cmd);
template <typename T>
void buildCmd(std::ostringstream &strm, const T &value)
{
strm << value;
}
template <typename T, typename... Args>
void buildCmd(std::ostringstream &strm, const T &value, const Args &... args)
{
strm << value << " ";
buildCmd(strm, args...);
}
template <typename... Args>
void exec(const Args &... args)
{
std::ostringstream strm;
buildCmd(strm, args...);
exec(strm.str());
}
template <typename... Args>
void execShowCmd(const Args &... args)
{
std::ostringstream strm;
buildCmd(strm, args...);
execShowCmd(strm.str());
}
void makeDir(const std::string &);