2007-05-27 12:01:53 -04:00
|
|
|
// $Id$
|
|
|
|
//
|
|
|
|
// SuperTuxKart - a fun racing game with go-kart
|
|
|
|
// Copyright (C) 2004 Steve Baker <sjbaker1@airmail.net>
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
2008-06-12 20:53:52 -04:00
|
|
|
// as published by the Free Software Foundation; either version 3
|
2007-05-27 12:01:53 -04:00
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
2008-02-29 22:18:53 -05:00
|
|
|
#ifndef HEADER_FILE_MANAGER_H
|
|
|
|
#define HEADER_FILE_MANAGER_H
|
2007-05-27 12:01:53 -04:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <vector>
|
|
|
|
#include <set>
|
|
|
|
#include "callback_manager.hpp"
|
|
|
|
|
1) Removed race_setup and race_mode data structures. All this
information is now only managed by the race_manager, no
more in-between objects to transfer information along.
2) The scores for grand prix are now defined in the stk_config.dat
file (10, 8, 6, 5, 4, .., 1, 0, 0) points
3) Bugfix: unlock information wasn't saved anymore. Added specific
saving after unlocking, plus re-inserted the 'generic' save
at the end of STK again.
4) bugfix/work around: Visual Studio complains about incompatible
iterators in sdldrv - apparently caused by using erase, and
then keep on using the iterator.
5) Fixed bug when running a race in a GP again (scores/times
were added each time).
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1681 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2008-04-09 09:52:48 -04:00
|
|
|
class FileManager
|
2007-05-27 12:01:53 -04:00
|
|
|
{
|
2008-02-28 22:26:07 -05:00
|
|
|
private:
|
|
|
|
bool m_is_full_path;
|
|
|
|
std::string m_root_dir;
|
|
|
|
std::vector<std::string> m_texture_search_path,
|
|
|
|
m_model_search_path,
|
|
|
|
m_music_search_path;
|
|
|
|
bool findFile (std::string& full_path,
|
|
|
|
const std::string& fname,
|
|
|
|
const std::vector<std::string>& search_path) const;
|
2008-02-25 21:30:28 -05:00
|
|
|
public:
|
2008-02-29 22:18:53 -05:00
|
|
|
FileManager();
|
|
|
|
~FileManager();
|
2007-05-27 12:01:53 -04:00
|
|
|
|
2008-03-26 22:38:10 -04:00
|
|
|
std::string getHomeDir () const;
|
|
|
|
std::string getTrackDir () const;
|
|
|
|
std::string getKartDir () const;
|
|
|
|
std::string getHerringDir () const;
|
|
|
|
std::string getTranslationDir() const;
|
2008-03-14 05:49:17 -04:00
|
|
|
std::vector<std::string>getMusicDirs() const;
|
2008-03-26 22:38:10 -04:00
|
|
|
std::string getTextureFile (const std::string& fname) const;
|
|
|
|
std::string getKartFile (const std::string& fname,
|
|
|
|
const std::string& kart="") const;
|
|
|
|
std::string getTrackFile (const std::string& fname,
|
|
|
|
const std::string& track="") const;
|
|
|
|
std::string getConfigFile (const std::string& fname) const;
|
|
|
|
std::string getHighscoreFile (const std::string& fname) const;
|
|
|
|
std::string getLogFile (const std::string& fname) const;
|
|
|
|
std::string getHerringFile (const std::string& fname) const;
|
|
|
|
std::string getMusicFile (const std::string& fname) const;
|
|
|
|
std::string getSFXFile (const std::string& fname) const;
|
|
|
|
std::string getFontFile (const std::string& fname) const;
|
|
|
|
std::string getModelFile (const std::string& fname) const;
|
2007-05-27 12:01:53 -04:00
|
|
|
|
2008-02-27 06:53:43 -05:00
|
|
|
void listFiles(std::set<std::string>& result, const std::string& dir,
|
2008-03-14 05:49:17 -04:00
|
|
|
bool is_full_path=false, bool make_full_path=false)
|
2007-05-27 12:01:53 -04:00
|
|
|
const;
|
|
|
|
|
2008-02-28 22:26:07 -05:00
|
|
|
void pushTextureSearchPath(const std::string& path)
|
|
|
|
{ m_texture_search_path.push_back(path);}
|
|
|
|
void pushModelSearchPath (const std::string& path)
|
|
|
|
{ m_model_search_path.push_back(path); }
|
|
|
|
void pushMusicSearchPath (const std::string& path)
|
|
|
|
{ m_music_search_path.push_back(path); }
|
|
|
|
void popTextureSearchPath () {m_texture_search_path.pop_back(); }
|
|
|
|
void popModelSearchPath () {m_model_search_path.pop_back(); }
|
|
|
|
void popMusicSearchPath () {m_music_search_path.pop_back(); }
|
2007-05-27 12:01:53 -04:00
|
|
|
void initConfigDir();
|
|
|
|
private:
|
2008-02-28 22:26:07 -05:00
|
|
|
void makePath (std::string& path, const std::string& dir,
|
|
|
|
const std::string& fname) const;
|
2007-05-27 12:01:53 -04:00
|
|
|
};
|
|
|
|
|
2008-02-29 22:18:53 -05:00
|
|
|
extern FileManager* file_manager;
|
2007-05-27 12:01:53 -04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|