diff options
-rw-r--r-- | platform_utils.py | 22 |
1 files changed, 1 insertions, 21 deletions
diff --git a/platform_utils.py b/platform_utils.py index 4cf994bc..29060099 100644 --- a/platform_utils.py +++ b/platform_utils.py | |||
@@ -259,24 +259,4 @@ def realpath(path): | |||
259 | 259 | ||
260 | Availability: Windows, Unix. | 260 | Availability: Windows, Unix. |
261 | """ | 261 | """ |
262 | if isWindows(): | 262 | return os.path.realpath(path) |
263 | current_path = os.path.abspath(path) | ||
264 | path_tail = [] | ||
265 | for c in range(0, 100): # Avoid cycles | ||
266 | if islink(current_path): | ||
267 | target = readlink(current_path) | ||
268 | current_path = os.path.join( | ||
269 | os.path.dirname(current_path), target | ||
270 | ) | ||
271 | else: | ||
272 | basename = os.path.basename(current_path) | ||
273 | if basename == "": | ||
274 | path_tail.append(current_path) | ||
275 | break | ||
276 | path_tail.append(basename) | ||
277 | current_path = os.path.dirname(current_path) | ||
278 | path_tail.reverse() | ||
279 | result = os.path.normpath(os.path.join(*path_tail)) | ||
280 | return result | ||
281 | else: | ||
282 | return os.path.realpath(path) | ||