more generic way to determine path, works in MacOS