35a36,42
> def searchpath(path, file):
> for p in path:
> f = joinpath(p, file)
> if os.path.exists(f):
> return f
> raise IOError, "Can't find file '%s' on path." % file
>
38c45
< return joinpath(disk.dir, file)
---
> return searchpath(disk.path, file)
42c49
< return joinpath(binary.dir, file)
---
> return searchpath(binary.path, file)
46c53
< return joinpath(script.dir, file)
---
> return searchpath(script.path, file)
49c56
< if not system.dir:
---
> if not system.path:
51c58
< path = env['M5_PATH'].split(':')
---
> path = env['M5_PATH'].split(':')
53c60
< path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ]
---
> path = [ '/dist/m5/system', '/n/poolfs/z/dist/m5/system' ]
55,59c62,63
< for system.dir in path:
< if os.path.isdir(system.dir):
< break
< else:
< raise ImportError, "Can't find a path to system files."
---
> # filter out non-existent directories
> system.path = filter(os.path.isdir, path)
61,66c65,66
< if not binary.dir:
< binary.dir = joinpath(system.dir, 'binaries')
< if not disk.dir:
< disk.dir = joinpath(system.dir, 'disks')
< if not script.dir:
< script.dir = joinpath(config_root, 'boot')
---
> if not system.path:
> raise IOError, "Can't find a path to system files."
68,71c68,78
< system.dir = None
< binary.dir = None
< disk.dir = None
< script.dir = None
---
> if not binary.path:
> binary.path = [joinpath(p, 'binaries') for p in system.path]
> if not disk.path:
> disk.path = [joinpath(p, 'disks') for p in system.path]
> if not script.path:
> script.path = [joinpath(config_root, 'boot')]
>
> system.path = None
> binary.path = None
> disk.path = None
> script.path = None