I think readlink only follows one level, this should get the canonical path (absolute and to the last level)

This commit is contained in:
Mattias Andrée 2012-08-22 00:11:10 +02:00
parent f76bef8fac
commit 5744c13146

View file

@ -257,7 +257,7 @@ class Ponysay():
if (len(pony) > 5) and (pony[-5:] == '.pony'): if (len(pony) > 5) and (pony[-5:] == '.pony'):
ponies.append(pony[:-5]) ponies.append(pony[:-5])
ponies.sort() ponies.sort()
pairs = [(pony, os.readlink(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else '') for pony in ponies] pairs = [(pony, os.path.realpath(ponydir + pony + '.pony') if os.path.islink(ponydir + pony + '.pony') else '') for pony in ponies]
ponymap = {} ponymap = {}
for pair in pairs: for pair in pairs: