Changes to paths: What it means for scripts and plugins

February 10th, 2009 Jonathan

As a follow up to my last post, scripters and plugin writers should be aware of the best practises for accessing files under python:

1.  Don’t use the old Q:, P:, T:, U:, Z: paths. Replace these with their [Link] below.

2.  Use xbmc.translatePath() to translate any path to it’s true path if/when you need to read or write from the filesystem.

Note that xbmc.translatePath() will take care of number 1 for you in the meantime, but this functionality is not guaranteed to be available forever.

So what should you use?

1.  Use [Link] if you need to read or write to the writeable version of the xbmc install folder.

2.  Use [Link] if you need to read or write to the current users userdata folder.

3.  Use special://temp/ if you need to read or write to a temporary location.

If you absolutely have to, you can also:

4.  Use special://xbmc/ to read from the xbmc install folder itself.

5.  Use special://masterprofile/ to read from the master users’ userdata folder.

These should not be needed by the majority of scripts, however, so if you find yourself needing to do either of 4 or 5, please contact me so that I know why, and can see whether there’s a better way to do things.

  1. Scott
    February 14th, 2009 at 19:58 | #1

    I Think Apple Movie Trailers will use special://masterprofile/ as it shares the .cache folder among users. This use to be T:\\.

    Only the DB is per user. special://profile/

  2. jmarshall
    February 14th, 2009 at 20:04 | #2

    That makes alot of sense Scott – good call. Anything shared across all users by a script (cache files as you point out) should certainly be kept in there. I guess the key is that you shouldn’t be reading and writing stuff there without thinking about it carefully. In particular, you shouldn’t be interfering with the files and folders that XBMC places in those directories.

  3. Scott
    February 14th, 2009 at 20:33 | #3

    would it make sense to have a special://allusers/ folder just for this, like windows?

  4. jmarshall
    February 14th, 2009 at 20:35 | #4

    I guess that’s effectively what special://masterprofile/ is in some respects, though you could place the cached info into special://home/ as well if you wanted to (once win32 gets fixed up at least!)

  5. February 24th, 2009 at 19:42 | #5

    Any plans for a new release to support the new paths?

    Thanks,
    Dan

  6. jmarshall
    February 24th, 2009 at 19:59 | #6

    @Dan: The usual XBMC release schedule applies. The next official stable release is scheduled for April 2009, and ofcourse community releases on windows + OS X, and SVN PPA releases on linux are available in the meantime.

  7. February 25th, 2009 at 19:36 | #7

    Thanks J, looking forward to the new release.

Comments are closed.