SearchPaths.cpp

Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <sys/stat.h>
00003 #include <sys/types.h>
00004 #include "SearchPaths.h"
00005 
00006 using namespace Fluxus;
00007 
00008 SearchPaths *SearchPaths::m_Singleton = NULL;
00009 
00010 SearchPaths* SearchPaths::Get()
00011 {
00012     if (!m_Singleton)
00013     {
00014         m_Singleton = new SearchPaths;
00015     }
00016     return m_Singleton;
00017 }
00018 
00019 void SearchPaths::Shutdown()
00020 {
00021     if (m_Singleton)
00022     {
00023         delete m_Singleton;
00024     }
00025 }
00026     
00027 string SearchPaths::GetFullPath(const string &Filename)
00028 {
00029     for (vector<string>::iterator i=m_Paths.begin(); i!=m_Paths.end(); i++)
00030     {
00031         string path = *i+Filename;
00032         struct stat sb;
00033         if (!stat(path.c_str(), &sb))
00034         {
00035             return path;
00036         }
00037     }
00038     return Filename;
00039 }
00040 
00041 void SearchPaths::AddPath(const string &Path)
00042 {
00043     m_Paths.push_back(Path);
00044 }

Generated on Mon Feb 11 06:54:25 2008 for The Fluxus Renderer (libfluxus) by  doxygen 1.5.1