-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shared.cpp
49 lines (41 loc) · 990 Bytes
/
Shared.cpp
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
/*
** EPITECH PROJECT, 2019
** OOP_arcade_2018
** File description:
** Shared
*/
#include "Shared.hpp"
Shared::Shared()
{
}
Shared::~Shared()
{
}
static bool endsWith(const std::string& str, const std::string& suffix)
{
return str.size() >= suffix.size() && 0 == str.compare(str.size()-suffix.size(), suffix.size(), suffix);
}
std::vector<std::string> Shared::getGraphLibName()
{
std::vector<std::string> vec;
DIR *pdir = NULL;
dirent *pent = NULL;
pdir = opendir("./lib");
while (pent = readdir(pdir))
if (endsWith(pent->d_name, ".so"))
vec.push_back(pent->d_name);
closedir(pdir);
return vec;
}
std::vector<std::string> Shared::getGameLibName()
{
std::vector<std::string> vec;
DIR *pdir = NULL;
dirent *pent = NULL;
pdir = opendir("./games");
while (pent = readdir(pdir))
if (endsWith(pent->d_name, ".so"))
vec.push_back(pent->d_name);
closedir(pdir);
return vec;
}