dsrc isn't necessary for this repo
[client-tools.git] / src / external / 3rd / application / UiBuilder / FileLocator.cpp
blob8fe679487dfe51cc977aa77a1d4e570e7d61739d
1 // ======================================================================
2 //
3 // FileLocator.cpp
4 // copyright (c) 2001 Sony Online Entertainment
5 //
6 // ======================================================================
8 #include "FirstUiBuilder.h"
9 #include "FileLocator.h"
11 #include <stdio.h>
13 // ======================================================================
14 FileLocator * FileLocator::ms_gFileLocator = 0;
16 //-----------------------------------------------------------------
18 FileLocator::FileLocator () :
19 m_paths ()
23 //-----------------------------------------------------------------
25 const bool FileLocator::findFile (const char * filename, UINarrowString & result)
27 for (PathVector_t::iterator iter = m_paths.begin (); iter != m_paths.end (); ++iter)
29 UINarrowString pathToCheck = *iter + "/" + filename;
31 FILE * fl = fopen (pathToCheck.c_str (), "r");
33 if (fl == 0)
34 continue;
36 fclose (fl);
38 result = pathToCheck;
39 return true;
42 return false;
44 //-----------------------------------------------------------------
45 void FileLocator::addPath (UINarrowString path)
47 m_paths.push_back (path);
49 //-----------------------------------------------------------------
50 void FileLocator::ExplicitDestroy ()
52 delete ms_gFileLocator;
53 ms_gFileLocator = 0;
56 // ======================================================================