-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.cpp
More file actions
58 lines (39 loc) · 1.34 KB
/
main.cpp
File metadata and controls
58 lines (39 loc) · 1.34 KB
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
55
56
57
58
#include "include/GApplicationHandler.h"
#include "include/ConfigsHandler.h"
#include "include/NamedPipeHandler.h"
#include <argp.h>
#include <iostream>
std::string getDirectoryPrefix()
{
const char *xdgConfigHome = std::getenv("XDG_CONFIG_HOME");
if (xdgConfigHome && *xdgConfigHome != '\0')
return std::string(xdgConfigHome) + "/WayVes/";
else
{
const char *home = std::getenv("HOME");
if (home && *home != '\0')
return std::string(home) + "/.config/WayVes/";
else
Errors::throwError("HOME environment variable not set");
}
return "";
}
int main(int argc, char *args[])
{
Arguments *arguments = new Arguments(argc, args);
arguments->signalGApps();
char *configFileName = arguments->configFileName;
std::string instance = std::string(arguments->instance == NULL ? "" : arguments->instance);
if (instance.empty())
instance = "default";
std::string overrideFile = "";
while (true)
{
ConfigsHandler *configsHandler = new ConfigsHandler(overrideFile.empty() ? configFileName : (char *)overrideFile.c_str(), getDirectoryPrefix());
configsHandler->initialiseGTKApps(instance);
NamedPipeHandler *namedPipeHandler = new NamedPipeHandler(configsHandler->classNames, instance, &overrideFile);
namedPipeHandler->pollForPipes();
delete configsHandler;
delete namedPipeHandler;
}
}