Permalink
Browse files

[iOS] Add "Copy to Kodi" functionality

  • Loading branch information...
1 parent 527a251 commit 3e2d04ffb4e52118825a1d774e9a03b4d3d8f237 @DanTheMan827 DanTheMan827 committed with Daniel May 8, 2016
@@ -0,0 +1,32 @@
+<sources>
+ <programs>
+ <default pathversion="1"></default>
+ </programs>
+ <video>
+ <default pathversion="1"></default>
+ <source>
+ <name>Inbox</name>
+ <path pathversion="1">special://envhome/Documents/Inbox/</path>
+ <allowsharing>true</allowsharing>
+ </source>
+ </video>
+ <music>
+ <default pathversion="1"></default>
+ <source>
+ <name>Inbox</name>
+ <path pathversion="1">special://envhome/Documents/Inbox/</path>
+ <allowsharing>true</allowsharing>
+ </source>
+ </music>
+ <pictures>
+ <default pathversion="1"></default>
+ <source>
+ <name>Inbox</name>
+ <path pathversion="1">special://envhome/Documents/Inbox/</path>
+ <allowsharing>true</allowsharing>
+ </source>
+ </pictures>
+ <files>
+ <default pathversion="1"></default>
+ </files>
+</sources>
View
@@ -387,9 +387,14 @@ extern "C" void __stdcall cleanup_emu_environ();
// Utility function used to copy files from the application bundle
// over to the user data directory in Application Support/Kodi.
//
-static void CopyUserDataIfNeeded(const std::string &strPath, const std::string &file)
+static void CopyUserDataIfNeeded(const std::string &strPath, const std::string &file, const std::string &destname = "")
{
- std::string destPath = URIUtils::AddFileToFolder(strPath, file);
+ std::string destPath;
+ if (destname == "")
+ destPath = URIUtils::AddFileToFolder(strPath, file);
+ else
+ destPath = URIUtils::AddFileToFolder(strPath, destname);
+
if (!CFile::Exists(destPath))
{
// need to copy it across
@@ -469,7 +474,12 @@ bool CApplication::Create()
win32_exception::install_handler();
#endif
-
+
+ #if defined(TARGET_POSIX)
+ // set special://envhome
+ CSpecialProtocol::SetEnvHomePath(getenv("HOME"));
+ #endif
+
// only the InitDirectories* for the current platform should return true
bool inited = InitDirectoriesLinux();
if (!inited)
@@ -481,6 +491,10 @@ bool CApplication::Create()
CopyUserDataIfNeeded("special://masterprofile/", "RssFeeds.xml");
CopyUserDataIfNeeded("special://masterprofile/", "favourites.xml");
CopyUserDataIfNeeded("special://masterprofile/", "Lircmap.xml");
+
+ #ifdef TARGET_DARWIN_IOS
+ CopyUserDataIfNeeded("special://masterprofile/", "iOS/sources.xml", "sources.xml");
+ #endif
if (!CLog::Init(CSpecialProtocol::TranslatePath("special://logpath").c_str()))
{
@@ -65,6 +65,11 @@ void CSpecialProtocol::SetUserHomePath(const std::string &dir)
SetPath("userhome", dir);
}
+void CSpecialProtocol::SetEnvHomePath(const std::string &dir)
+{
+ SetPath("envhome", dir);
+}
+
void CSpecialProtocol::SetMasterProfilePath(const std::string &dir)
{
SetPath("masterprofile", dir);
@@ -154,6 +159,7 @@ std::string CSpecialProtocol::TranslatePath(const CURL &url)
else if (RootDir == "xbmc" ||
RootDir == "xbmcbin" ||
RootDir == "home" ||
+ RootDir == "envhome" ||
RootDir == "userhome" ||
RootDir == "temp" ||
RootDir == "profile" ||
@@ -247,6 +253,7 @@ void CSpecialProtocol::LogPaths()
CLog::Log(LOGNOTICE, "special://xbmc/ is mapped to: %s", GetPath("xbmc").c_str());
CLog::Log(LOGNOTICE, "special://xbmcbin/ is mapped to: %s", GetPath("xbmcbin").c_str());
CLog::Log(LOGNOTICE, "special://masterprofile/ is mapped to: %s", GetPath("masterprofile").c_str());
+ CLog::Log(LOGNOTICE, "special://envhome/ is mapped to: %s", GetPath("envhome").c_str());
CLog::Log(LOGNOTICE, "special://home/ is mapped to: %s", GetPath("home").c_str());
CLog::Log(LOGNOTICE, "special://temp/ is mapped to: %s", GetPath("temp").c_str());
CLog::Log(LOGNOTICE, "special://logpath/ is mapped to: %s", GetPath("logpath").c_str());
@@ -31,6 +31,7 @@
Linux: ~/.kodi/
OS X: ~/Library/Application Support/Kodi/
Win32: ~/Application Data/XBMC/
+ special://envhome/ - on posix systems this will be equal to the $HOME
special://userhome/ - a writable version of the user home directory
Linux, OS X: ~/.kodi
Win32: home directory of user
@@ -58,6 +59,7 @@ class CSpecialProtocol
static void SetXBMCFrameworksPath(const std::string &path);
static void SetHomePath(const std::string &path);
static void SetUserHomePath(const std::string &path);
+ static void SetEnvHomePath(const std::string &path);
static void SetMasterProfilePath(const std::string &path);
static void SetTempPath(const std::string &path);
static void SetLogPath(const std::string &dir);
Oops, something went wrong.

0 comments on commit 3e2d04f

Please sign in to comment.