]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - plugins/vfspk3/vfs.cpp
refresh DPK VFS before refreshing textures
[xonotic/netradiant.git] / plugins / vfspk3 / vfs.cpp
index e92bad76c016694bda7f4391d1fa2c0b6f478050..bee7403beb75ae81f5168581d6315668ef808cde 100644 (file)
@@ -660,7 +660,7 @@ void InitDirectory( const char* directory, ArchiveModules& archiveModules ){
                                for ( Archives::iterator i = archives.begin(); i != archives.end(); ++i ) {
                                        const char* name = i->c_str();
                                        const char* ext = strrchr( name, '.' );
-                                       if ( !string_compare_nocase_upper( ext, "dpk" ) ) {
+                                       if ( !string_compare_nocase_upper( ext, ".dpk" ) ) {
                                                CopiedString name_final = CopiedString( StringRange( name, ext ) );
                                                fullpath = string_new_concat( path, name );
                                                AddDpkPak( name_final.c_str(), fullpath, true );
@@ -673,8 +673,8 @@ void InitDirectory( const char* directory, ArchiveModules& archiveModules ){
                                {
                                        const char* name = i->c_str();
                                        const char* ext = strrchr( name, '.' );
-                                       if ( !string_compare_nocase_upper( ext, "pk3" )
-                                               || !string_compare_nocase_upper( ext, "pk4" ) ) {
+                                       if ( !string_compare_nocase_upper( ext, ".pk3" )
+                                               || !string_compare_nocase_upper( ext, ".pk4" ) ) {
                                                fullpath = string_new_concat( path, i->c_str() );
                                                InitPakFile( archiveModules, fullpath );
                                                string_release( fullpath, string_length( fullpath ) );
@@ -684,8 +684,8 @@ void InitDirectory( const char* directory, ArchiveModules& archiveModules ){
                                {
                                        const char* name = i->c_str();
                                        const char* ext = strrchr( name, '.' );
-                                       if ( !string_compare_nocase_upper( ext, "pk3" )
-                                               || !string_compare_nocase_upper( ext, "pk4" ) ) {
+                                       if ( !string_compare_nocase_upper( ext, ".pk3" )
+                                               || !string_compare_nocase_upper( ext, ".pk4" ) ) {
                                                fullpath = string_new_concat( path, i->c_str() );
                                                InitPakFile( archiveModules, fullpath );
                                                string_release( fullpath, string_length( fullpath ) );
@@ -848,6 +848,12 @@ void initDirectory( const char *path ){
        InitDirectory( path, FileSystemQ3API_getArchiveModules() );
 }
 void initialise(){
+       load();
+       globalOutputStream() << "filesystem initialised\n";
+       g_observers.realise();
+}
+
+void load(){
        ArchiveModules& archiveModules = FileSystemQ3API_getArchiveModules();
        bool is_dpk_vfs = GetArchiveTable( archiveModules, "dpk" );
 
@@ -873,10 +879,19 @@ void initialise(){
                g_pakfile_paths.clear();
                g_loaded_dpk_paks.clear();
        }
+}
 
-       globalOutputStream() << "filesystem initialised\n";
-       g_observers.realise();
+void clear() {
+       // like shutdown() but does not unrealise (keep map etc.)
+       Shutdown();
 }
+
+void refresh(){
+       // like initialise() but does not realise (keep map etc.)
+       load();
+       globalOutputStream() << "filesystem refreshed\n";
+}
+
 void shutdown(){
        g_observers.unrealise();
        globalOutputStream() << "filesystem shutdown\n";