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)) {
printf("File %s not readable\n", fileName.c_str());
fileName.assign(CFG_DIR);
fileName.append("/data/");
fileName += name;
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());
return false; 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,20 +400,14 @@ 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)) {
printf("File %s not readable\n", fileName.c_str());
fileName.assign(CFG_DIR);
fileName.append("/data/");
fileName += name;
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());
return false; return false;
} }
}
std::ifstream file(fileName); std::ifstream file(fileName);
if (!file.is_open()) { if (!file.is_open()) {

Loading…
Cancel
Save

Powered by TurnKey Linux.