Fix device detection on OS X when users have a customized environment.plist

This commit is contained in:
Kovid Goyal 2008-12-18 13:20:38 -08:00
parent 30a11fdfaa
commit 42e6fb932b

View File

@ -19,10 +19,10 @@ class File(object):
self.is_readonly = not os.access(path, os.W_OK)
self.ctime = stats.st_ctime
self.wtime = stats.st_mtime
self.size = stats.st_size
if path.endswith(os.sep):
self.size = stats.st_size
if path.endswith(os.sep):
path = path[:-1]
self.path = path
self.path = path
self.name = os.path.basename(path)
@ -108,7 +108,10 @@ class PRS505(Device):
@classmethod
def get_osx_mountpoints(cls, raw=None):
if raw is None:
raw = subprocess.Popen('ioreg -w 0 -S -c IOMedia'.split(),
ioreg = '/usr/sbin/ioreg'
if not os.access(ioreg, os.X_OK):
ioreg = 'ioreg'
raw = subprocess.Popen((ioreg+' -w 0 -S -c IOMedia').split(),
stdout=subprocess.PIPE).stdout.read()
lines = raw.splitlines()
names = {}