Exemple #1
0
def actual_path(path):
	''' If this path is actually a symlink (or an Apple alias) it returns the actual path '''
	# Unfortunately I think os.path.realpath is broken under windows, but I can't check
	if check_apple_alias:
		return File.FSResolveAliasFile(path, True)[0].as_pathname()
	elif os.path.islink(path):
		return os.readlink(path)
	else:
		return path
Exemple #2
0
def resolvealiases(path):
    try:
        fsr, d1, d2 = File.FSResolveAliasFile(path, 1)
        path = fsr.as_pathname()
        return path
    except (File.Error, ValueError), (error, str):
        if error <> -120:
            raise
        dir, file = os.path.split(path)
        return os.path.join(resolvealiases(dir), file)