Tips for coding python scripts / plugins compatible with Linux, Mac, Windows AND Xbox
#16
using os.getcwd() in conjunction with the recommended url style path divider '/' creates a path with mixed dividers.

ie.

DIR_HOME = os.getcwd().replace( ";", "" )
DIR_RESOURCES_LIB = "/".join( [DIR_HOME, "resources", "lib"] )
sys.path.insert(0, xbmc.translatePath(DIR_RESOURCES_LIB) )

gives

C:\Program Files\XBMC\scripts\<scriptname>/resources/lib

which is ugly, but it still works on win32 and xbox (don't know about others)
HOME_DIR is only really used as a base for relative subdirs and it doesnt upset
translatePath() but any recommendations to get a path all using the same divider ?

Note:: xbmc.Language( DIR_HOME ) which appends 'resources' must produce:
C:\Program Files\XBMC\scripts\<scriptname>/resources/

Is this likely to be a future problem ?

BBB
Retired from Add-on dev
Reply


Messages In This Thread
Great but... - by Gamester17 - 2008-09-08, 22:48
[No subject] - by jmarshall - 2008-09-08, 22:57
[No subject] - by Temhil - 2008-09-08, 23:30
[No subject] - by jmarshall - 2008-09-08, 23:35
[No subject] - by Gamester17 - 2008-09-09, 10:33
[No subject] - by blittan - 2008-09-09, 23:48
[No subject] - by BigBellyBilly - 2008-09-12, 12:23
[No subject] - by Temhil - 2008-09-13, 00:44
[No subject] - by BigBellyBilly - 2008-09-13, 09:54
FIXED in XBMC Beta1 - by Temhil - 2008-10-07, 01:25
[No subject] - by Nuka1195 - 2008-10-07, 01:51
[No subject] - by blittan - 2008-10-07, 08:40
[No subject] - by CrashX - 2009-02-16, 05:11
[No subject] - by CrashX - 2009-02-17, 02:51
[No subject] - by BigBellyBilly - 2009-02-17, 13:24
[No subject] - by Nuka1195 - 2009-02-17, 15:33
[No subject] - by BigBellyBilly - 2009-02-17, 15:36
[No subject] - by plex - 2011-12-06, 12:47
Logout Mark Read Team Forum Stats Members Help
Tips for coding python scripts / plugins compatible with Linux, Mac, Windows AND Xbox2