[fbreader] Changed getPwdDir to return the current directory

It was returning the value of PWD environment variable which
isn't necessarily the same thing.
This commit is contained in:
Slava Monich 2015-08-09 14:36:51 +03:00
parent 87bdefbe05
commit dac803cd4e

View file

@ -32,8 +32,12 @@
#include "ZLUnixFileOutputStream.h"
static std::string getPwdDir() {
char *pwd = getenv("PWD");
return (pwd != 0) ? pwd : "";
std::string cwd;
long size = pathconf(".", _PC_PATH_MAX);
char* buf = new char[size];
if (getcwd(buf, size)) cwd = buf;
delete [] buf;
return cwd;
}
static std::string getHomeDir() {