SearchPaths.cpp

Go to the documentation of this file.
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         // should I stat?
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 }

Generated on Tue Sep 4 23:22:18 2007 for The Fluxus Renderer (libfluxus) by  doxygen 1.5.1