Skip to content
Snippets Groups Projects
Commit e28002a1 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

fileutils: keep functions out of global namespace

parent 0661b858
No related branches found
No related tags found
No related merge requests found
...@@ -155,7 +155,7 @@ std::vector<sfl::Codec*> AudioCodecFactory::scanCodecDirectory() ...@@ -155,7 +155,7 @@ std::vector<sfl::Codec*> AudioCodecFactory::scanCodecDirectory()
if (envDir) if (envDir)
dirToScan.push_back(std::string(envDir) + DIR_SEPARATOR_STR); dirToScan.push_back(std::string(envDir) + DIR_SEPARATOR_STR);
const char *progDir = get_program_dir(); const char *progDir = fileutils::get_program_dir();
if (progDir) if (progDir)
dirToScan.push_back(std::string(progDir) + DIR_SEPARATOR_STR + "audio/codecs/"); dirToScan.push_back(std::string(progDir) + DIR_SEPARATOR_STR + "audio/codecs/");
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <libgen.h> #include <libgen.h>
#include <cstdlib> #include <cstdlib>
namespace fileutils {
static char *program_dir = NULL; static char *program_dir = NULL;
void set_program_dir(char *program_path) void set_program_dir(char *program_path)
...@@ -42,3 +43,5 @@ const char *get_program_dir() ...@@ -42,3 +43,5 @@ const char *get_program_dir()
{ {
return program_dir; return program_dir;
} }
}
...@@ -31,7 +31,9 @@ ...@@ -31,7 +31,9 @@
#ifndef __FILEUTILS_H__ #ifndef __FILEUTILS_H__
#define __FILEUTILS_H__ #define __FILEUTILS_H__
namespace fileutils {
void set_program_dir(char *program_path); void set_program_dir(char *program_path);
const char *get_program_dir(); const char *get_program_dir();
}
#endif // __FILEUTILS_H__ #endif // __FILEUTILS_H__
...@@ -78,7 +78,7 @@ static bool check_dir(const char *path) ...@@ -78,7 +78,7 @@ static bool check_dir(const char *path)
int int
main(int argc, char **argv) main(int argc, char **argv)
{ {
set_program_dir(argv[0]); fileutils::set_program_dir(argv[0]);
// makeCommandOptionParse allocates the object with operator new, so // makeCommandOptionParse allocates the object with operator new, so
// auto_ptr is fine in this context. // auto_ptr is fine in this context.
// TODO: This should eventually be replaced with std::unique_ptr for C++0x // TODO: This should eventually be replaced with std::unique_ptr for C++0x
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment