try to fix cwd
This commit is contained in:
parent
72e80721e8
commit
ec61e1f9e5
4
main.cpp
4
main.cpp
@ -257,12 +257,12 @@ inline bool PathRelative(std::string path) {
|
||||
#include <unistd.h>
|
||||
|
||||
std::string cwd() {
|
||||
ssize_t size = 100, nsize;
|
||||
ssize_t size = 1000, nsize;
|
||||
|
||||
while(1) {
|
||||
char buffer[size];
|
||||
if ((nsize = readlink("/proc/self/cwd", buffer, size)) < size) {
|
||||
buffer[size+1] = 0;
|
||||
buffer[size] = 0;
|
||||
return std::string(buffer);
|
||||
}
|
||||
size = nsize + 100;
|
||||
|
Loading…
Reference in New Issue
Block a user