[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1627] trunk/py/scripts/addons/modules/ extensions_framework/util.py: extensions_framework: make util. path_relative_to_export more robust on win32
Doug Hammond
doughammond at hamsterfight.co.uk
Mon Feb 21 02:11:35 CET 2011
Revision: 1627
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=1627
Author: dougal2
Date: 2011-02-21 01:11:35 +0000 (Mon, 21 Feb 2011)
Log Message:
-----------
extensions_framework: make util.path_relative_to_export more robust on win32
Modified Paths:
--------------
trunk/py/scripts/addons/modules/extensions_framework/util.py
Modified: trunk/py/scripts/addons/modules/extensions_framework/util.py
===================================================================
--- trunk/py/scripts/addons/modules/extensions_framework/util.py 2011-02-21 00:11:50 UTC (rev 1626)
+++ trunk/py/scripts/addons/modules/extensions_framework/util.py 2011-02-21 01:11:35 UTC (rev 1627)
@@ -52,8 +52,15 @@
"""Return a path that is relative to the export path"""
global export_path
p = filesystem_path(p)
+ ep = os.path.dirname(export_path)
+
+ if os.sys.platform == 'win32':
+ # Prevent an error whereby python thinks C: and c: are different drives
+ if p[1] == ':': p[0] = p[0].lower()
+ if ep[1] == ':': ep[0] = ep[0].lower()
+
try:
- relp = os.path.relpath(p, os.path.dirname(export_path))
+ relp = os.path.relpath(p, ep)
except ValueError: # path on different drive on windows
relp = p
More information about the Bf-extensions-cvs
mailing list