]> git.tdb.fi Git - libs/game.git/blob - source/game/resources.cpp
Add resource container references to Director and Stage
[libs/game.git] / source / game / resources.cpp
1 #include <msp/core/application.h>
2 #include <msp/fs/dir.h>
3 #include <msp/fs/stat.h>
4 #include "resources.h"
5
6 using namespace std;
7
8 namespace Msp::Game {
9
10 ApplicationResources::ApplicationResources()
11 {
12         FS::Path data_dir = FS::get_sys_data_dir()/"data";
13 #ifdef DEBUG
14         if(FS::exists(data_dir))
15                 dir_src.add_directory(data_dir);
16         add_source(dir_src);
17 #endif
18
19         FS::Path main_pack = FS::get_sys_data_dir()/(Application::get_name()+".mdp");
20         if(FS::exists(main_pack))
21                 pack_src.add_pack_file(main_pack.str());
22         if(FS::exists(data_dir))
23         {
24                 for(const string &f: FS::list_filtered(data_dir, "\\.mdp$"))
25                         pack_src.add_pack_file((data_dir/f).str());
26         }
27         add_source(pack_src);
28 }
29
30 } // namespace Msp::Game