[libbluray-devel] bdj: use temporary storage when cache or persistent root is unknown

hpi1 git at videolan.org
Sun Aug 7 16:01:34 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sun Aug  7 13:22:07 2016 +0300| [4e5e700cc8bfabc40163300d199abfe37cc62b5a] | committer: hpi1

bdj: use temporary storage when cache or persistent root is unknown

Previously $PWD/bluray/ was used.

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=4e5e700cc8bfabc40163300d199abfe37cc62b5a
---

 src/libbluray/bdj/bdj.c | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/src/libbluray/bdj/bdj.c b/src/libbluray/bdj/bdj.c
index 1c17eb3..87ce53a 100644
--- a/src/libbluray/bdj/bdj.c
+++ b/src/libbluray/bdj/bdj.c
@@ -368,10 +368,15 @@ static const char *_bdj_persistent_root(BDJ_STORAGE *storage)
         }
 
         data_home = file_get_data_home();
-        storage->persistent_root = str_printf("%s" DIR_SEP "bluray" DIR_SEP "dvb.persistent.root" DIR_SEP, data_home ? data_home : "");
-        X_FREE(data_home);
+        if (data_home) {
+            storage->persistent_root = str_printf("%s" DIR_SEP "bluray" DIR_SEP "dvb.persistent.root" DIR_SEP, data_home);
+            X_FREE(data_home);
+            BD_DEBUG(DBG_BDJ, "LIBBLURAY_PERSISTENT_ROOT not set, using %s\n", storage->persistent_root);
+        }
 
-        BD_DEBUG(DBG_BDJ, "LIBBLURAY_PERSISTENT_ROOT not set, using %s\n", storage->persistent_root);
+        if (!storage->persistent_root) {
+            BD_DEBUG(DBG_BDJ | DBG_CRIT, "WARNING: BD-J persistent root not set\n");
+        }
     }
 
     return storage->persistent_root;
@@ -394,10 +399,15 @@ static const char *_bdj_buda_root(BDJ_STORAGE *storage)
         }
 
         cache_home = file_get_cache_home();
-        storage->cache_root = str_printf("%s" DIR_SEP "bluray" DIR_SEP "bluray.bindingunit.root" DIR_SEP, cache_home ? cache_home : "");
-        X_FREE(cache_home);
+        if (cache_home) {
+            storage->cache_root = str_printf("%s" DIR_SEP "bluray" DIR_SEP "bluray.bindingunit.root" DIR_SEP, cache_home);
+            X_FREE(cache_home);
+            BD_DEBUG(DBG_BDJ, "LIBBLURAY_CACHE_ROOT not set, using %s\n", storage->cache_root);
+        }
 
-        BD_DEBUG(DBG_BDJ, "LIBBLURAY_CACHE_ROOT not set, using %s\n", storage->cache_root);
+        if (!storage->cache_root) {
+            BD_DEBUG(DBG_BDJ | DBG_CRIT, "WARNING: BD-J cache root not set\n");
+        }
     }
 
     return storage->cache_root;



More information about the libbluray-devel mailing list