]> git.tdb.fi Git - libs/demoscene.git/commitdiff
Load any collection files from the data directory
authorMikko Rasa <tdb@tdb.fi>
Wed, 22 May 2019 11:47:49 +0000 (14:47 +0300)
committerMikko Rasa <tdb@tdb.fi>
Wed, 22 May 2019 11:49:02 +0000 (14:49 +0300)
source/resources.cpp

index cba8054cf4b9f3636b02a0630fde7fa585a03d32..e5e893d58dc9e283ed35ffe33f88aab7c9e1d1c6 100644 (file)
@@ -1,3 +1,4 @@
+#include <msp/fs/dir.h>
 #include <msp/fs/stat.h>
 #include "resources.h"
 
@@ -11,10 +12,13 @@ Resources::Resources(const string &pack_name):
        set_default_texture_anisotropy(8);
        set_srgb_conversion(true);
 
-       if(FS::exists("data"))
+       FS::Path data_dir = "data";
+       if(FS::exists(data_dir))
        {
-               dir_source.add_directory("data");
+               dir_source.add_directory(data_dir);
                add_source(dir_source);
+               for(const auto &c: FS::list_filtered(data_dir, "\\.mdc$"))
+                       load(*this, (data_dir/c).str());
        }
        else
        {