Skip to content

Commit 4cfa771

Browse files
committed
The os.path.abspath(location) is needed when inserting the UNC_PREFIX
for long path in windows. In addition, adding code to make sure both the input and filter are in posix path format before doing any string partition.
1 parent 39025a5 commit 4cfa771

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

about_code_tool/about.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ class AboutFile(object):
557557
"""
558558
def __init__(self, location=None):
559559
self.about_resource = None
560-
self.location = location
560+
self.location = os.path.abspath(location)
561561

562562
self.parsed = None
563563
self.parsed_fields = None
@@ -1222,6 +1222,10 @@ def get_relative_path(self, location):
12221222
"""
12231223
user_loc = normpath(self.location)
12241224
if os.path.isdir(self.normalized_location):
1225+
# Making sure both are in posix path format before
1226+
# doing any string partition.
1227+
location = posix_path(location)
1228+
user_loc = posix_path(user_loc)
12251229
parent_name = basename(user_loc)
12261230
subpath = '/' + parent_name + location.partition(user_loc)[2]
12271231
if user_loc[-1] == '/':

0 commit comments

Comments
 (0)