How to copy files to the addon_data folder when the addon is installed - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +---- Forum: PVR (https://forum.kodi.tv/forumdisplay.php?fid=136) +---- Thread: How to copy files to the addon_data folder when the addon is installed (/showthread.php?tid=336534) |
How to copy files to the addon_data folder when the addon is installed - phunkyfish - 2018-10-16 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 RE: How to copy files to the addon_data folder when the addon is installed - spiff - 2018-10-16 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). RE: How to copy files to the addon_data folder when the addon is installed - phunkyfish - 2018-10-16 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! RE: How to copy files to the addon_data folder when the addon is installed - spiff - 2018-10-16 use kodi::GetAddonPath() + "resources/data"; ref https://github.com/notspiff/visualization.projectm/blob/master/src/Main.cpp#L120 How to copy files to the addon_data folder when the addon is installed - ksooo - 2018-10-16 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. RE: How to copy files to the addon_data folder when the addon is installed - spiff - 2018-10-16 right, old construct; char path[1024]; XBMC->GetSetting("__addonpath__", path); RE: How to copy files to the addon_data folder when the addon is installed - phunkyfish - 2018-10-16 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? RE: How to copy files to the addon_data folder when the addon is installed - spiff - 2018-10-17 yes. RE: How to copy files to the addon_data folder when the addon is installed - phunkyfish - 2018-10-18 (2018-10-17, 11:19)spiff Wrote: yes. Thanks! Have it working like a charm now 😉 |