Are there any advantages to using xbmcvfs?
#1
I am relatively new to ensuring cross-platform compatibility with file IO and I don't have all the platforms available to debug on.
I have been wondering if there are any advantages to using xbmcvfs over its native python os. equivalents.

Is there additional cross-platform compatibility built-in to these commands?
Is there any performance advantage?

Besides issues with chmod and access to directories on different platforms, are there any other common 'gotchas' that I need to plan for?

Thanks for any feedback.
Reply
#2
python os only understands local filesystems, while xbmcvfs also works on remote filesystems (smb:// etc..)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Thanks, that's good to know. May I ask, do any of the more spartan systems (i.e. Rpi) use samba for any of the typical
Kodi directories, such as those returned by xbmc.translatePath('special:// .. ')?
Reply
#4
no.
Reply
#5
Actually it's possible (but rarely used) to move playlist video to a samba folder (I do) so in some rare case you might get a translated path with samba.
My approach to addons is to try to avoid to translatepath if possible and use xbmcvfs. if I really can't use xbmcvfs for some special access of the file I translate the path only at the very end without storing it.
Reply
#6
yes, i answered the 'by default'. should have mentioned that.
Reply
#7
You can safely use the os module unless you want to support the VFSs. Performance wise os module is a lot faster, but that should only relevant if you need to call those functions a lot. Only xbmcvfs 'gotcha' I can think of is the odd windows style api where slash at the end matters. For os.path there is dealing with unicode.
Reply
#8
Thanks everyone for the very useful advice.

Happy Thanksgiving!
Reply

Logout Mark Read Team Forum Stats Members Help
Are there any advantages to using xbmcvfs?0