Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2016-03-29 10:22:35 +0300
committerCampbell Barton <ideasman42@gmail.com>2016-03-29 10:30:08 +0300
commit2fae1719f82c10e3ac2bfba7cc45f2534a0b1a02 (patch)
treea0e3ef689f9a30afd25b22d30e5672e89720f355 /release/scripts/modules/bpy/path.py
parentb1f918bcc53d552dec2a5327b15f77751dca0712 (diff)
Fix T47986: OBJ Import fails w/ imagepath encoding
Diffstat (limited to 'release/scripts/modules/bpy/path.py')
-rw-r--r--release/scripts/modules/bpy/path.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/release/scripts/modules/bpy/path.py b/release/scripts/modules/bpy/path.py
index 99c46e4b034..30f6c8eebed 100644
--- a/release/scripts/modules/bpy/path.py
+++ b/release/scripts/modules/bpy/path.py
@@ -35,6 +35,7 @@ __all__ = (
"extensions_audio",
"is_subdir",
"module_names",
+ "native_pathsep",
"reduce_dirs",
"relpath",
"resolve_ncase",
@@ -349,6 +350,28 @@ def basename(path):
return _os.path.basename(path[2:] if path[:2] in {"//", b"//"} else path)
+def native_pathsep(path):
+ """
+ Replace the path separator with the systems native ``os.sep``.
+ """
+ if type(path) is str:
+ if _os.sep == "/":
+ return path.replace("\\", "/")
+ else:
+ if path.startswith("//"):
+ return "//" + path[2:].replace("/", "\\")
+ else:
+ return path.replace("/", "\\")
+ else: # bytes
+ if _os.sep == "/":
+ return path.replace(b"\\", b"/")
+ else:
+ if path.startswith(b"//"):
+ return b"//" + path[2:].replace(b"/", b"\\")
+ else:
+ return path.replace(b"/", b"\\")
+
+
def reduce_dirs(dirs):
"""
Given a sequence of directories, remove duplicates and