Hi all,
@
emveepee pointed the finder on the right direction about this issue, thanks to him!
I also investigated on my side and it seems that Kodi (on Apple TV of course) mixing paths with and without the
/private
prefix.
In reality the
getenv("HOME")
line at beginning of the runtime return a path with
/private
prefix while
CTVOSFileUtils::GetOSCachesDirectory()
functions return a path without this prefix.
This cause some issue in the DirectoryCache system because some directories are registered with this prefix and other without, causing some file existence check to fail.
This is the issue with the multi instance PVR addons, they are not able to find the existing XML setting file because the Directorycache system thinks this file does not exist despite it really exists...
The patch proposed by emveepee should works, but my proposal fix is to use the
/private
prefix everywhere in Kodi to avoid any confusion or complexity.
This is my proposal:
Code:
--- a/xbmc/platform/darwin/tvos/filesystem/TVOSFileUtils.mm
+++ b/xbmc/platform/darwin/tvos/filesystem/TVOSFileUtils.mm
@@ -35,6 +35,7 @@ const char* CTVOSFileUtils::GetOSCachesDirectory()
std::call_once(cache_flag, [] {
NSString* cachePath =
NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).lastObject;
+ cachePath = [@"/private" stringByAppendingString:cachePath];
cacheFolder = cachePath.UTF8String;
URIUtils::RemoveSlashAtEnd(cacheFolder);
});
Code:
--- a/xbmc/platform/darwin/tvos/TVOSNSUserDefaults.mm
+++ b/xbmc/platform/darwin/tvos/TVOSNSUserDefaults.mm
@@ -67,19 +67,10 @@ bool CTVOSNSUserDefaults::Synchronize()
void CTVOSNSUserDefaults::GetDirectoryContents(const std::string& path,
std::vector<std::string>& contents)
{
- // tvos path adds /private/../..
- // We need to strip this as GetUserHomeDirectory() doesnt have private in the path
- std::string subpath = path;
- const std::string& str_private = "/private";
- size_t pos = subpath.find(str_private.c_str(), 0, str_private.length());
-
- if (pos != std::string::npos)
- subpath.erase(pos, str_private.length());
-
std::string userDataDir =
URIUtils::AddFileToFolder(CTVOSFileUtils::GetUserHomeDirectory(), "userdata");
- if (subpath.find(userDataDir) == std::string::npos)
+ if (path.find(userDataDir) == std::string::npos)
return;
What do you think?