X-Git-Url: https://git.bzium.org/embe/man-symlinker.git/blobdiff_plain/c010ee2581fa29514389af2201ec82f11f6ae2b3..a5b19f03b5b69156c4e3fb3c085c6b08e03f9d81:/man-symlinker?ds=inline diff --git a/man-symlinker b/man-symlinker index bb52842..ff28a36 100755 --- a/man-symlinker +++ b/man-symlinker @@ -12,7 +12,8 @@ MAX_LEN = 1024 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) @@ -32,11 +33,11 @@ def process_file(name): 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) - print 'Converted {} into a symlink to {}'.format(name, link) + print 'Converted {} into a symlink to {}'.format(full_name, link) return True def main(args=[]):