]> git.bzium.org/ - embe/man-symlinker.git/blobdiff - man-symlinker
Poprawka względnych ścieżek.
[embe/man-symlinker.git] / man-symlinker
index bb52842d30ad3b9fc430ebf6e834fc1a6e19fc02..e337c6d6919df18463d7deb6c704947a2b8d44f4 100755 (executable)
@@ -12,7 +12,8 @@ MAX_LEN = 1024
 SO_RE = re.compile(r'^\.so\s+(.*)$')
 
 def process_file(name):
 SO_RE = re.compile(r'^\.so\s+(.*)$')
 
 def process_file(name):
-    m = MAN_NAME_RE.search(name)
+    full_name = os.path.join(os.getcwd(), name)
+    m = MAN_NAME_RE.search(full_name)
     if not m:
         return False
     category = m.group(1)
     if not m:
         return False
     category = m.group(1)
@@ -32,7 +33,7 @@ def process_file(name):
         return False
     if link.startswith(dir_name+'/'):
         link = link[len(dir_name)+1:]
         return False
     if link.startswith(dir_name+'/'):
         link = link[len(dir_name)+1:]
-    else:
+    elif '/' in link:
         link = '../' + link
     os.unlink(name)
     os.symlink(link, name)
         link = '../' + link
     os.unlink(name)
     os.symlink(link, name)