Get rid of hardcoded path

master
Geoffrey Merck 4 years ago
parent 878ff18123
commit adf4f055de

@ -329,15 +329,13 @@ void CAudioUnit::spellReflector(unsigned int id, const std::string &reflector)
}
}
bool CAudioUnit::readAMBE(const std::string& name)
bool CAudioUnit::readAMBE(const std::string& dir, const std::string& name)
{
std::string dir = std::getenv("HOME");
std::string fileName = dir + "/" + name;
struct stat sbuf;
if (stat(fileName.c_str(), &sbuf)) {
CLog::logInfo("File %s not readable\n", fileName.c_str());
fileName.assign(CFG_DIR);
fileName.append("/data/");
fileName += name;
if (stat(fileName.c_str(), &sbuf)) {
@ -396,15 +394,13 @@ bool CAudioUnit::readAMBE(const std::string& name)
return true;
}
bool CAudioUnit::readIndex(const std::string& name)
bool CAudioUnit::readIndex(const std::string& dir, const std::string& name)
{
std::string dir = std::getenv("HOME");
std::string fileName = dir + "/" + name;
struct stat sbuf;
if (stat(fileName.c_str(), &sbuf)) {
CLog::logInfo("File %s not readable\n", fileName.c_str());
fileName.assign(CFG_DIR);
fileName.append("/data/");
fileName += name;
if (stat(fileName.c_str(), &sbuf)) {

@ -114,7 +114,7 @@ private:
void spellReflector(unsigned int id, const std::string& reflector);
void sendStatus(LINK_STATUS status, const std::string& reflector, const std::string& text);
static bool readAMBE(const std::string& name);
static bool readIndex(const std::string& name);
static bool readAMBE(const std::string& dir, const std::string& name);
static bool readIndex(const std::string& dir, const std::string& name);
};

@ -1259,7 +1259,7 @@ void CDStarGatewayThread::readStatusFiles()
void CDStarGatewayThread::readStatusFile(const std::string& filename, unsigned int n, std::string& var)
{
std::string fullFileName = std::string(CFG_DIR) + "/" + filename;
std::string fullFileName = m_dataDir + "/" + filename;
std::string text;
std::ifstream file;

Loading…
Cancel
Save

Powered by TurnKey Linux.