[vlc-devel] [PATCH] modules: on winstore we cannot save plugins.dat in the plugins folder

Steve Lhomme robux4 at videolabs.io
Tue Sep 26 14:16:35 CEST 2017


We can save it in the config folder.
---
 src/modules/bank.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/modules/bank.c b/src/modules/bank.c
index 4cc0e9a74e..41b320f101 100644
--- a/src/modules/bank.c
+++ b/src/modules/bank.c
@@ -398,6 +398,17 @@ static void AllocatePluginDir (module_bank_t *bank, unsigned maxdepth,
 static void AllocatePluginPath(vlc_object_t *obj, const char *path,
                                cache_mode_t mode)
 {
+    const char *cache_path;
+#if VLC_WINSTORE_APP
+    cache_path = config_GetUserDir(VLC_CONFIG_DIR);
+    if (cache_path == NULL)
+    {
+        msg_Warn(obj, "no suitable storage path for the plugins cache");
+        return;
+    }
+#else
+    cache_path = path;
+#endif
     module_bank_t bank =
     {
         .obj = obj,
@@ -406,7 +417,7 @@ static void AllocatePluginPath(vlc_object_t *obj, const char *path,
     };
 
     if (mode & CACHE_READ_FILE)
-        bank.cache = vlc_cache_load(obj, path, &modules.caches);
+        bank.cache = vlc_cache_load(obj, cache_path, &modules.caches);
     else
         msg_Dbg(bank.obj, "ignoring plugins cache file");
 
@@ -431,7 +442,10 @@ static void AllocatePluginPath(vlc_object_t *obj, const char *path,
     }
 
     if (mode & CACHE_WRITE_FILE)
-        CacheSave(obj, path, bank.plugins, bank.size);
+        CacheSave(obj, cache_path, bank.plugins, bank.size);
+#if VLC_WINSTORE_APP
+    free((char*)cache_path);
+#endif
 
     free(bank.plugins);
 }
-- 
2.12.1



More information about the vlc-devel mailing list