No longer trying to read audio files from home

feature/AudioLoginLogoff
Geoffrey Merck 6 years ago
parent 6026a54330
commit f7e9a1df09

@ -338,20 +338,15 @@ bool CAudioUnit::lookup(unsigned int id, const std::string &name, const in_addr&
bool CAudioUnit::readAMBE(const std::string& name) bool CAudioUnit::readAMBE(const std::string& name)
{ {
std::string dir = std::getenv("HOME"); std::string dir = DATA_DIR;
std::string fileName = dir + "/" + name; std::string fileName = dir + "/" + name;
struct stat sbuf; struct stat sbuf;
if (stat(fileName.c_str(), &sbuf)) { if (stat(fileName.c_str(), &sbuf)) {
printf("File %s not readable\n", fileName.c_str()); printf("File %s not readable\n", fileName.c_str());
fileName.assign(CFG_DIR); return false;
fileName.append("/data/");
fileName += name;
if (stat(fileName.c_str(), &sbuf)) {
printf("File %s not readable\n", fileName.c_str());
return false;
}
} }
unsigned int fsize = sbuf.st_size; unsigned int fsize = sbuf.st_size;
FILE *file = fopen(fileName.c_str(), "rb"); FILE *file = fopen(fileName.c_str(), "rb");
@ -405,19 +400,13 @@ bool CAudioUnit::readAMBE(const std::string& name)
bool CAudioUnit::readIndex(const std::string& name) bool CAudioUnit::readIndex(const std::string& name)
{ {
std::string dir = std::getenv("HOME"); std::string dir = DATA_DIR;
std::string fileName = dir + "/" + name; std::string fileName = dir + "/" + name;
struct stat sbuf; struct stat sbuf;
if (stat(fileName.c_str(), &sbuf)) { if (stat(fileName.c_str(), &sbuf)) {
printf("File %s not readable\n", fileName.c_str()); printf("File %s not readable\n", fileName.c_str());
fileName.assign(CFG_DIR); return false;
fileName.append("/data/");
fileName += name;
if (stat(fileName.c_str(), &sbuf)) {
printf("File %s not readable\n", fileName.c_str());
return false;
}
} }
std::ifstream file(fileName); std::ifstream file(fileName);

Loading…
Cancel
Save

Powered by TurnKey Linux.