         }
     }
 
-    private static func fixDependencyLocation(fileSystem: TSCBasic.FileSystem, packageKind: PackageReference.Kind, dependencyLocation: String) throws -> String {
-        let packagePath: AbsolutePath
-        switch packageKind {
-        case .root(let path):
-            packagePath = path
-        case .fileSystem(let path):
-            packagePath = path
-        case .localSourceControl(let path):
-            packagePath = path
-        case .remoteSourceControl:
-            // nothing to fix
-            return dependencyLocation
-        case .registry:
-            // nothing to fix
-            return dependencyLocation
-        }
-
+    private static func sanitizeDependencyLocation(fileSystem: TSCBasic.FileSystem, packageKind: PackageReference.Kind, dependencyLocation: String) throws -> String {
         if dependencyLocation.hasPrefix("~/") {
             // If the dependency URL starts with '~/', try to expand it.
             return fileSystem.homeDirectory.appending(RelativePath(String(dependencyLocation.dropFirst(2)))).pathString

        fileSystem: TSCBasic.FileSystem
    ) throws -> PackageDependency {
        // cleans up variants of path based location
        var location = try fixDependencyLocation(fileSystem: fileSystem, packageKind: packageKind, dependencyLocation: location)
        // location mapping (aka mirrors) if any
        location = identityResolver.mappedLocation(for: location)
        // a package in a git location, may be a remote URL or on disk

            }
            return AbsolutePath(location).pathString
        } else if parseScheme(dependencyLocation) == nil {
            // If the URL has no scheme, we treat it as a path (either absolute or relative to the base URL).
            switch packageKind {
            case .root(let packagePath), .fileSystem(let packagePath), .localSourceControl(let packagePath):
                return AbsolutePath(dependencyLocation, relativeTo: packagePath).pathString
            case .remoteSourceControl, .registry:
                // nothing to "fix"
                return dependencyLocation
            }
        } else {
            // nothing to "fix"
            return dependencyLocation
        }
    }

    private static func parsePlatforms(_ package: JSON) throws -> [PlatformDescription] {
