How to copy files to the addon_data folder when the addon is installed
#1
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
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#2
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).
Reply
#3
Thanks @spiff 

I can see the files here: <kodi-install-dir>/addons/<addon-name>/resources/data

Do you know what the special:// path is to access those files?

Thanks in advance again!
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#4
use kodi::GetAddonPath() + "resources/data";

ref https://github.com/notspiff/visualizatio...n.cpp#L120
Reply
#5
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.
Reply
#6
right, old construct;

char path[1024];
XBMC->GetSetting("__addonpath__", path);
Reply
#7
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?
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply
#8
yes.
Reply
#9
(2018-10-17, 11:19)spiff Wrote: yes.

Thanks! Have it working like a charm now 😉
Maintainer of Enigma2 PVR addon: repo, docschangelog
How to create a full debug: here
Reply

Logout Mark Read Team Forum Stats Members Help
How to copy files to the addon_data folder when the addon is installed0