Copying a folder into Userdata
#1
Hi everyone.

I have been trying to learn how to build xbmc for a few months now and I have implemented a few patches that I have found on the web and got them to work but there is something I have been stuck on now for a week and I have googled non stop but can't seem to find examples or answers to what I am trying to achieve.

I have added in a multi language patch for the onscreen keyboard and I want to be able to copy the entire folder over to the Userdata folder.

In application.cpp I have found the following.

Code:
static void CopyUserDataIfNeeded(const CStdString &strPath, const CStdString &file)
{
  CStdString destPath = URIUtils::AddFileToFolder(strPath, file);
  if (!CFile::Exists(destPath))
  {
    // need to copy it across
    CStdString srcPath = URIUtils::AddFileToFolder("special://xbmc/userdata/", file);
    CFile::Cache(srcPath, destPath);
  }
}
Code:
// copy required files
  CopyUserDataIfNeeded("special://masterprofile/", "RssFeeds.xml");
  CopyUserDataIfNeeded("special://masterprofile/", "favourites.xml");
  CopyUserDataIfNeeded("special://masterprofile/", "Lircmap.xml");

If I add my files one at a time to the end of this then they will work, eg.

Code:
CopyUserDataIfNeeded("special://masterprofile/", "/languagekeys/english.xml");
CopyUserDataIfNeeded("special://masterprofile/", "/languagekeys/french.xml");
CopyUserDataIfNeeded("special://masterprofile/", "/languagekeys/russian.xml");

But I want to be able to copy over the entire "languagekeys" folder in one go as there are loads of files in there and they will be changing often.

I think I need a URIUtils::GetDirectory function but I have no idea how I would implement this.

If any of you kind people could please point me in the right direction or tell me what code I need that would be brilliant. Also can anyone suggest any good reading material to help me understand the coding better.

Thank you very much.
Wendy
Reply

Logout Mark Read Team Forum Stats Members Help
Copying a folder into Userdata0