refactored FileSystem._resolve