From f7e9a1df09e0a0e357ec9f9885eca6fc15ed0c5a Mon Sep 17 00:00:00 2001 From: Geoffrey Merck Date: Sun, 15 Mar 2020 20:45:56 +0100 Subject: [PATCH] No longer trying to read audio files from home --- AudioUnit.cpp | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/AudioUnit.cpp b/AudioUnit.cpp index c707768..8afdcfe 100644 --- a/AudioUnit.cpp +++ b/AudioUnit.cpp @@ -338,20 +338,15 @@ bool CAudioUnit::lookup(unsigned int id, const std::string &name, const in_addr& bool CAudioUnit::readAMBE(const std::string& name) { - std::string dir = std::getenv("HOME"); + std::string dir = DATA_DIR; std::string fileName = dir + "/" + name; 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)) { - printf("File %s not readable\n", fileName.c_str()); - return false; - } + return false; } + unsigned int fsize = sbuf.st_size; 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) { - std::string dir = std::getenv("HOME"); + std::string dir = DATA_DIR; std::string fileName = dir + "/" + name; 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)) { - printf("File %s not readable\n", fileName.c_str()); - return false; - } + return false; } std::ifstream file(fileName);