Commits

Anonymous committed c452119

babplay_randomly: Treat symlinks correctly.

Comments (0)

Files changed (1)

babplay_randomly.py

 	exit()
 
 # Be able to recognize directories. 
-from os.path import isdir, join
+from os.path import isdir, join, realpath
 from os import listdir
 # And walk a directory tree. 
 from os import walk
 	new_files = []
 	for i in files: 
 		# directly add files
-		if not isdir(i): 
+		if not isdir(realpath(i)): 
 			new_files.append(i)
 		# but check the contents of dirs. 
 		else: 
 			try: 
-				for dir_path, dirs, dir_files in [i for i in walk(i)]: 
+				for dir_path, dirs, dir_files in [i for i in walk(i, followlinks=True)]: 
 					new_files += [join(dir_path, f) for f in dir_files]
 			except: 
 				pass