             }
         }
         // Remove the editable checkout from disk.
-        if localFileSystem.exists(path) {
-            try removeFileTree(path)
+        if fileSystem.exists(path) {
+            fileSystem.removeFileTree(path)
         }
         // If this was the last editable dependency, remove the editables directory too.
-        if localFileSystem.exists(editablesPath), try localFileSystem.getDirectoryContents(editablesPath).isEmpty {
-            try removeFileTree(editablesPath)
+        if fileSystem.exists(editablesPath), try fileSystem.getDirectoryContents(editablesPath).isEmpty {
+            fileSystem.removeFileTree(editablesPath)
         }
         // Restore the dependency state.
         dependencyMap[dependency.repository] = basedOn

    /// available.
    private func restoreState() throws -> Bool {
        // If the state doesn't exist, don't try to load and fail.
        if !exists(statePath) {
            return false
        }

        // Load the state.
        let json = try JSON(bytes: try localFileSystem.readFileContents(statePath))

        // Load the state from JSON.
        guard case let .dictionary(contents) = json,

        for dependency in dependencies where dependency.isInEditableState {
            // If some edited dependency has been removed, mark it as unedited.
            let dependencyPath = editablesPath.appending(dependency.subpath)
            if !fileSystem.exists(dependencyPath) {
                try unedit(dependency: dependency, forceRemove: true)
                // FIXME: Use diagnosics engine when we have that.
                print("warning: \(dependencyPath.asString) was being edited but has been removed, falling back to original checkout.")
