forked from rileytestut/AltServer-Windows
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathInstalledApp.cpp
More file actions
executable file
·57 lines (47 loc) · 1.19 KB
/
InstalledApp.cpp
File metadata and controls
executable file
·57 lines (47 loc) · 1.19 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
#include "InstalledApp.h"
#include "ServerError.hpp"
InstalledApp::InstalledApp(plist_t plist)
{
auto nameNode = plist_dict_get_item(plist, "CFBundleName");
auto identifierNode = plist_dict_get_item(plist, "CFBundleIdentifier");
auto executableNode = plist_dict_get_item(plist, "CFBundleExecutable");
if (nameNode == NULL || identifierNode == NULL || executableNode == NULL)
{
throw ServerError(ServerErrorCode::InvalidApp);
}
char* name = NULL;
plist_get_string_val(nameNode, &name);
this->_name = name;
char* identifier = NULL;
plist_get_string_val(identifierNode, &identifier);
this->_bundleIdentifier = identifier;
char* executable = NULL;
plist_get_string_val(executableNode, &executable);
this->_executableName = executable;
}
InstalledApp::~InstalledApp()
{
}
bool InstalledApp::operator<(const InstalledApp& app) const
{
if (this->name() == app.name())
{
return this->bundleIdentifier() < app.bundleIdentifier();
}
else
{
return this->name() < app.name();
}
}
std::string InstalledApp::name() const
{
return _name;
}
std::string InstalledApp::bundleIdentifier() const
{
return _bundleIdentifier;
}
std::string InstalledApp::executableName() const
{
return _executableName;
}