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

* #6507 : find codecs dir in build directory

No need to set CODECS_PATH when running the daemon from build directory anymore
parent 31f0c689
Branches
Tags
No related merge requests found
......@@ -20,7 +20,8 @@ sflphoned_SOURCES = \
call.cpp \
account.cpp \
logger.cpp \
numbercleaner.cpp
numbercleaner.cpp \
fileutils.cpp
# Redefine the USE_IAX variable here, so that it could be used in managerimpl
if USE_IAX
......@@ -58,7 +59,8 @@ noinst_HEADERS = \
accountcreator.h \
call.h \
logger.h \
numbercleaner.h
numbercleaner.h \
fileutils.h
libsflphone_la_LIBADD = \
$(src)/libs/utilspp/libutilspp.la \
......
......@@ -35,6 +35,7 @@
#include <cstdlib>
#include "audiocodecfactory.h"
#include "fileutils.h"
AudioCodecFactory::AudioCodecFactory() : _CodecsMap(), _defaultCodecOrder(), _Cache(), _nbCodecs(), _CodecInMemory()
......@@ -192,11 +193,13 @@ 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/";
// 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);
......
/*
* Copyright (C) 2011 Savoir-Faire Linux Inc.
* Author: Rafaël Carré <rafael.carre@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include <libgen.h>
static char *program_dir;
void set_program_dir(char *program_path)
{
program_dir = dirname(program_path);
}
const char *get_program_dir(void)
{
return program_dir;
}
/*
* Copyright (C) 2011 Savoir-Faire Linux Inc.
* Author: Rafaël Carré <rafael.carre@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef __FILEUTILS_H__
#define __FILEUTILS_H__
void set_program_dir(char *program_path);
const char *get_program_dir(void);
#endif // __FILEUTILS_H__
......@@ -39,6 +39,7 @@
#include <sys/stat.h>
#include <cc++/common.h>
#include "global.h"
#include "fileutils.h"
#include "dbus/dbusmanager.h"
#include "manager.h"
......@@ -66,6 +67,8 @@ CommandOptionNoArg help (
int
main (int argc, char **argv)
{
set_program_dir(argv[0]);
int exit_code = 0;
Logger::setConsoleLog (false);
......
#!/bin/bash
CODECS_PATH="../src/audio/codecs" ../src/sflphoned -d -c
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment