- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers_linux.cpp
More file actions
Latest commit
31 lines (25 loc) · 610 Bytes
/
Copy pathhelpers_linux.cpp
File metadata and controls
31 lines (25 loc) · 610 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
#include"helpers.h"
#include<fmt/format.h>
#ifdef DEBUG
#defineOUTPUT""
#else
#defineOUTPUT">/dev/null 2>&1"
#endif
namespacehelpers
{
boolcan_execute(std::string exename)
{
auto cmd = fmt::format("which {} {}", exename, OUTPUT);
returnsystem(cmd.data()) == 0;
}
boolexecute(std::string exename, std::string args)
{
auto cmd = fmt::format("{} {} {}", exename, args, OUTPUT);
returnsystem(cmd.data()) == 0;
}
boolcopy(std::string source, std::string destination)
{
auto cmd = fmt::format("cp {} {} {}", source, destination, OUTPUT);
returnsystem(cmd.data()) == 0;
}
}