blob: 7aa5bad0cf647708c20310fc89e37e07f65a5a07 (
plain)
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
|
#include <mbgl/util/uv.hpp>
#include <uv.h>
namespace uv {
std::string cwd() {
#if UV_VERSION_MAJOR == 0 && UV_VERSION_MINOR <= 10
char dir[512];
uv_cwd(dir, 512);
return dir;
#else
size_t max = 0;
std::string dir;
do {
max += 256;
dir.resize(max);
uv_cwd(const_cast<char *>(dir.data()), &max);
} while (max == dir.size());
dir.resize(max - 1);
return dir;
#endif
}
}
|