Posts: 2,518
Joined: May 2007
Reputation:
118
2018-10-16, 06:53
(This post was last modified: 2018-10-16, 06:57 by phunkyfish.)
Hi,
I have some XML config files that the user can edit if they wish. My question is how do I get them into the addon_data folder when the addon is installed?
I thought that putting them in the resources/data folder would do it but no joy.
Thanks in advance
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
2018-10-16, 12:22
(This post was last modified: 2018-10-16, 12:23 by spiff.)
if the build system for you add-on is not custom, that is all it shall take. you might have to rerun cmake as it uses globbing. note, the files will not go to addon_data, it will go to a read-only location. if you want it in your writable data path, you have to do that from code (ie. load from resources, save to addon_data).
Posts: 1,887
Joined: Jan 2015
Reputation:
126
ksooo
Team-Kodi Developer
Posts: 1,887
2018-10-16, 15:03
(This post was last modified: 2018-10-16, 15:05 by ksooo.)
That won't work literally as pvr add-ons are not yet converted to c++ API, but there should be a construct for this in the old API, too. Old and new API cannot be mixed! At the phone, atm; cannot lookup.
Posts: 12,706
Joined: Nov 2003
Reputation:
129
spiff
Team-Kodi Member
Posts: 12,706
right, old construct;
char path[1024];
XBMC->GetSetting("__addonpath__", path);
Posts: 2,518
Joined: May 2007
Reputation:
118
Thanks guys.
And if I copy the files to the addon_data folder on startup then I would use, OpenFile, ReadFile, WriteFile etc. to do so. That would be best practice for that operation?