00001 #include <stdio.h>
00002 #include "SearchPaths.h"
00003
00004 using namespace Fluxus;
00005
00006 SearchPaths *SearchPaths::m_Singleton = NULL;
00007
00008 SearchPaths* SearchPaths::Get()
00009 {
00010 if (!m_Singleton)
00011 {
00012 m_Singleton = new SearchPaths;
00013 }
00014 return m_Singleton;
00015 }
00016
00017
00018 string SearchPaths::GetFullPath(const string &Filename)
00019 {
00020 for (vector<string>::iterator i=m_Paths.begin(); i!=m_Paths.end(); i++)
00021 {
00022 string file = *i+Filename;
00023
00024 FILE *fd=fopen(file.c_str(),"r");
00025 if (fd)
00026 {
00027 fclose(fd);
00028 return file;
00029 }
00030 }
00031 return Filename;
00032 }
00033
00034 void SearchPaths::AddPath(const string &Path)
00035 {
00036 m_Paths.push_back(Path);
00037 }