Skip to content
Snippets Groups Projects
Commit 8bef4318 authored by Rafaël Carré's avatar Rafaël Carré
Browse files

* #6507 : do not crash if the program is not sflphoned

(tests have their own executable)
parent 3cd7756c
No related branches found
No related tags found
No related merge requests found
......@@ -193,15 +193,16 @@ std::vector<sfl::Codec*> AudioCodecFactory::scanCodecDirectory (void)
std::string libDir = std::string (CODECS_DIR).append ("/");
std::string homeDir = std::string (HOMEDIR) + DIR_SEPARATOR_STR + "." + PROGDIR + "/";
std::string srcDir = std::string(get_program_dir()) + DIR_SEPARATOR_STR + "audio/codecs/";
const char *progDir = get_program_dir();
// look for a CODECS_PATH environment variable...used in tests
const char *envDir = getenv("CODECS_PATH");
std::vector<std::string> dirToScan;
dirToScan.push_back (homeDir);
dirToScan.push_back (libDir);
dirToScan.push_back (srcDir);
if (envDir)
dirToScan.push_back(std::string(envDir) + DIR_SEPARATOR_STR);
if (progDir)
dirToScan.push_back(std::string(progDir) + DIR_SEPARATOR_STR + "audio/codecs/");
for (i = 0 ; (unsigned int) i < dirToScan.size() ; i++) {
std::string dirStr = dirToScan[i];
......
......@@ -29,8 +29,9 @@
*/
#include <libgen.h>
#include <cstdlib>
static char *program_dir;
static char *program_dir = NULL;
void set_program_dir(char *program_path)
{
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment