Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

Keep an environment's saves when deleting it

Gabe0e2f1611e1f0
diff --git a/Sources/HighballApp/AppState.swift b/Sources/HighballApp/AppState.swift
index 1e5ee74..3ebeb57 100644
--- a/Sources/HighballApp/AppState.swift
+++ b/Sources/HighballApp/AppState.swift
@@ -2895,7 +2895,9 @@ final class AppState {
}
}
- func deleteBottle(_ name: String) {
+ /// Deletes an environment. With `keepSaves` its save folders are copied into Highball's
+ /// save backups first, and a copy that fails stops the delete.
+ func deleteBottle(_ name: String, keepSaves: Bool) {
// The row and its Delete item stay on screen for the whole operation, so without this a
// second click started a second delete and the loser reported "missing" for a delete that
// was in fact succeeding.
@@ -2905,17 +2907,24 @@ final class AppState {
cleanup: { [weak self] in self?.deletingBottles.remove(name) }) { [self] in
let store = bottleStore
let killer = killerFor(name)
+ let environment = paths.bottle(name), backups = paths.saveBackups
// Stop the bottle before anything moves: `wineserver -k` resolves the prefix by path,
// so after the rename it exits 1 and leaves the server running. It is a synchronous
// wineserver call that measured 2.3 s against a live server, so it belongs off the
// main actor with the purge rather than in front of it, freezing the window.
// A prefix can be tens of GB, and the old delete ran the whole walk on the main
// actor — 985 ms for 20,841 entries, minutes for a big Steam bottle.
- let leftovers = try await Task.detached {
+ // The saves are copied after the stop, so nothing is still writing them.
+ let (kept, leftovers) = try await Task.detached {
killer?()
- return try store.delete(name)
+ let kept = keepSaves ? try EnvironmentSaves.keep(environment: environment, name: name, backups: backups) : nil
+ return (kept, try store.delete(name))
}.value
await MainActor.run {
+ if keepSaves {
+ self.appendLog(kept.map { "kept the saves of '\(name)' in \($0.folder.path) (\(ByteCountFormatter.string(fromByteCount: $0.bytes, countStyle: .file)))" }
+ ?? "'\(name)' held no saves to keep")
+ }
if self.selectedBottle == name { self.selectedBottle = nil }
guard let first = leftovers.first else { return }
self.errorIsPartialSuccess = true
diff --git a/Sources/HighballApp/BottleView.swift b/Sources/HighballApp/BottleView.swift
index cdafe29..e2a6d3a 100644
--- a/Sources/HighballApp/BottleView.swift
+++ b/Sources/HighballApp/BottleView.swift
@@ -627,13 +627,7 @@ struct EnvironmentSettingsPage: View {
.navigationTitle(L("Environment settings"))
.navigationBarBackButtonHidden(showsInlineBack)
.background { PageCancelShortcut { dismiss() } }
- .confirmationDialog(UserFolders.hasFilesInside(driveC: bottle.driveC)
- ? L("Delete this environment? Its Windows drive and everything installed in it are removed, including the game saves kept in its Documents folder.")
- : L("Delete this environment? Its Windows drive and everything installed in it are removed."),
- isPresented: $confirmDelete, titleVisibility: .visible) {
- Button(L("Delete"), role: .destructive) { dismiss(); state.deleteBottle(bottle.name) }
- Button(L("Cancel"), role: .cancel) {}
- }
+ .deleteEnvironmentDialog(bottle.name, isPresented: $confirmDelete) { dismiss() }
.alert(L("About frame generation"), isPresented: $showFrameGenInfo) {
Button(L("Got it"), role: .cancel) {}
} message: {
@@ -671,6 +665,49 @@ struct EnvironmentSettingsPage: View {
}
}
+/// The question before an environment goes: keep a copy of its saves first (the default), or
+/// delete everything as before. The size of the copy is measured off the main actor while the
+/// question is up.
+private struct DeleteEnvironmentDialog: ViewModifier {
+ @Environment(AppState.self) private var state
+ let name: String?
+ @Binding var isPresented: Bool
+ let onDelete: () -> Void
+ @State private var savesSize: String?
+
+ func body(content: Content) -> some View {
+ content
+ .confirmationDialog(String(format: L("Delete the %@ environment?"), name ?? ""),
+ isPresented: $isPresented, titleVisibility: .visible) {
+ Button(L("Keep saves")) { delete(keepSaves: true) }.keyboardShortcut(.defaultAction)
+ Button(L("Delete everything"), role: .destructive) { delete(keepSaves: false) }
+ Button(L("Cancel"), role: .cancel) {}
+ } message: {
+ Text(savesSize.map { String(format: L("Its Windows drive and everything installed in it are removed. Keep saves first puts a copy of its saves folders (%@) in Highball's save-backups folder."), $0) }
+ ?? L("Its Windows drive and everything installed in it are removed. Keep saves first puts a copy of its saves folders in Highball's save-backups folder."))
+ }
+ .task(id: isPresented ? name : nil) {
+ savesSize = nil
+ guard isPresented, let name else { return }
+ let environment = state.paths.bottle(name)
+ let bytes = await Task.detached { EnvironmentSaves.bytes(environment: environment) }.value
+ savesSize = ByteCountFormatter.string(fromByteCount: bytes, countStyle: .file)
+ }
+ }
+
+ private func delete(keepSaves: Bool) {
+ guard let name else { return }
+ onDelete()
+ state.deleteBottle(name, keepSaves: keepSaves)
+ }
+}
+
+extension View {
+ func deleteEnvironmentDialog(_ name: String?, isPresented: Binding<Bool>, onDelete: @escaping () -> Void = {}) -> some View {
+ modifier(DeleteEnvironmentDialog(name: name, isPresented: isPresented, onDelete: onDelete))
+ }
+}
+
// MARK: - Onboarding & license sheet
struct OnboardingView: View {
diff --git a/Sources/HighballApp/L10n.swift b/Sources/HighballApp/L10n.swift
index 0d60426..9e9809d 100644
--- a/Sources/HighballApp/L10n.swift
+++ b/Sources/HighballApp/L10n.swift
@@ -670,8 +670,11 @@ enum L10n {
"Automatic": "Automatique",
"Creating the %@ environment — first boot takes about 90 seconds": "Création de l'environnement %@ — le premier démarrage prend environ 90 secondes",
"Delete environment…": "Supprimer l'environnement…",
- "Delete this environment? Its Windows drive and everything installed in it are removed.": "Supprimer cet environnement ? Son disque Windows et tout ce qui y est installé seront supprimés.",
- "Delete this environment? Its Windows drive and everything installed in it are removed, including the game saves kept in its Documents folder.": "Supprimer cet environnement ? Son disque Windows et tout ce qui y est installé seront supprimés, y compris les sauvegardes gardées dans son dossier Documents.",
+ "Delete the %@ environment?": "Supprimer l'environnement %@ ?",
+ "Keep saves": "Garder les sauvegardes",
+ "Delete everything": "Tout supprimer",
+ "Its Windows drive and everything installed in it are removed. Keep saves first puts a copy of its saves folders (%@) in Highball's save-backups folder.": "Son disque Windows et tout ce qui y est installé seront supprimés. Garder les sauvegardes place d'abord une copie de ses dossiers de sauvegarde (%@) dans le dossier save-backups de Highball.",
+ "Its Windows drive and everything installed in it are removed. Keep saves first puts a copy of its saves folders in Highball's save-backups folder.": "Son disque Windows et tout ce qui y est installé seront supprimés. Garder les sauvegardes place d'abord une copie de ses dossiers de sauvegarde dans le dossier save-backups de Highball.",
"Keep game files inside this environment": "Garder les fichiers des jeux dans cet environnement",
"Show the game's folder": "Afficher le dossier du jeu",
"Uninstall…": "Désinstaller…",
diff --git a/Sources/HighballApp/SettingsView.swift b/Sources/HighballApp/SettingsView.swift
index 3bf9c7f..cf2b5de 100644
--- a/Sources/HighballApp/SettingsView.swift
+++ b/Sources/HighballApp/SettingsView.swift
@@ -135,12 +135,7 @@ struct EnvironmentsPane: View {
}
}
.sheet(isPresented: $showCreate) { CreateBottleSheet() }
- .confirmationDialog("Delete environment \"\(pendingDelete ?? "")\"? This removes its Windows drive and everything installed in it, games included.",
- isPresented: .init(get: { pendingDelete != nil }, set: { if !$0 { pendingDelete = nil } }),
- titleVisibility: .visible) {
- Button(L("Delete"), role: .destructive) { if let n = pendingDelete { state.deleteBottle(n) }; pendingDelete = nil }
- Button(L("Cancel"), role: .cancel) { pendingDelete = nil }
- }
+ .deleteEnvironmentDialog(pendingDelete, isPresented: .init(get: { pendingDelete != nil }, set: { if !$0 { pendingDelete = nil } }))
#if DEBUG
// HB_DEBUG_SETTINGS="<environment>" (see ContentView) lands on that environment's page.
.task {
diff --git a/Sources/HighballKit/EnvironmentSaves.swift b/Sources/HighballKit/EnvironmentSaves.swift
new file mode 100644
index 0000000..578f9a8
--- /dev/null
+++ b/Sources/HighballKit/EnvironmentSaves.swift
@@ -0,0 +1,120 @@
+import Foundation
+
+/// The game saves an environment holds, kept when the environment is deleted. Games save under
+/// the Windows user's folders in drive_c/users/<name>: Saved Games, Documents (My Games), and
+/// AppData's Roaming, Local and LocalLow. Deleting the environment took all of them with it.
+///
+/// - Documents counts only when it is a folder inside the environment. The usual link to the
+/// Mac's Documents survives the delete anyway, and is never walked into.
+/// - Caches, temp files, logs and crash dumps are left out by name, and so are the Steam
+/// client's and Windows' own folders under AppData/Local: bulk, not saves.
+/// - A link inside these folders is copied as what it points at, because games write through
+/// them. A link to nothing is skipped, a link out of the environment is never followed (it
+/// could lead into the Mac's home folders), and a folder reached twice is copied once.
+public enum EnvironmentSaves {
+ /// The save folders under a Windows user's directory.
+ public static let folders = ["Saved Games", "Documents", "AppData/Roaming", "AppData/Local", "AppData/LocalLow"]
+ /// Folder names left out wherever they appear, compared lowercased.
+ public static let skippedNames: Set<String> = [
+ "cache", "caches", "temp", "tmp", "htmlcache", "shadercache", "gpucache", "d3dscache",
+ "crashpad", "crashdumps", "logs",
+ ]
+ /// Folder names left out directly under AppData/Local, compared lowercased.
+ public static let skippedInLocal: Set<String> = ["steam", "microsoft"]
+
+ /// One folder or file to keep. `path` is where it goes in the copy, starting with the user name.
+ public struct Entry: Equatable, Sendable {
+ public let source: URL
+ public let path: String
+ public let isDirectory: Bool
+ public let bytes: Int64
+ }
+
+ /// Everything a copy of the saves takes, folders before what they hold.
+ public static func entries(environment: URL) -> [Entry] {
+ guard let root = realPath(environment) else { return [] }
+ let driveC = URL(fileURLWithPath: root).appending(path: "drive_c", directoryHint: .isDirectory)
+ var visited = Set<String>()
+ var out: [Entry] = []
+ for user in UserFolders.userDirectories(driveC: driveC) {
+ for folder in folders {
+ let url = user.appending(path: folder)
+ if folder == UserFolders.folder, UserFolders.shape(userDirectory: user) != .inside { continue }
+ guard let real = inside(url, root: root) else { continue }
+ walk(real, path: "\(user.lastPathComponent)/\(folder)", inLocal: folder == "AppData/Local",
+ root: root, visited: &visited, into: &out)
+ }
+ }
+ return out
+ }
+
+ /// The size of the copy, in bytes.
+ public static func bytes(environment: URL) -> Int64 {
+ entries(environment: environment).reduce(0) { $0 + $1.bytes }
+ }
+
+ /// Copies the saves into `backups/environments/<name>-<date>`, filled under a `.partial` name
+ /// and renamed when complete, so the folder is either whole or absent. Returns the folder and
+ /// the bytes copied, or nil when the environment holds no saved file at all.
+ public static func keep(environment: URL, name: String, backups: URL, date: Date = Date()) throws -> (folder: URL, bytes: Int64)? {
+ let all = entries(environment: environment)
+ guard all.contains(where: { !$0.isDirectory }) else { return nil }
+ let stamp = DateFormatter()
+ stamp.locale = Locale(identifier: "en_US_POSIX")
+ stamp.dateFormat = "yyyy-MM-dd-HHmmss"
+ let parent = backups.appending(path: "environments", directoryHint: .isDirectory)
+ let folder = parent.appending(path: "\(name)-\(stamp.string(from: date))", directoryHint: .isDirectory)
+ let partial = parent.appending(path: folder.lastPathComponent + ".partial", directoryHint: .isDirectory)
+ let fm = FileManager.default
+ do {
+ try? fm.removeItem(at: partial)
+ try fm.createDirectory(at: partial, withIntermediateDirectories: true)
+ for entry in all {
+ let dest = partial.appending(path: entry.path)
+ if entry.isDirectory {
+ try fm.createDirectory(at: dest, withIntermediateDirectories: true)
+ } else {
+ try fm.copyItem(at: entry.source, to: dest)
+ }
+ }
+ try fm.moveItem(at: partial, to: folder)
+ } catch {
+ try? fm.removeItem(at: partial)
+ throw HighballError.failed("Highball could not keep a copy of the saves of '\(name)', so the environment was not deleted: \(error.localizedDescription)")
+ }
+ return (folder, all.reduce(0) { $0 + $1.bytes })
+ }
+
+ private static func walk(_ dir: String, path: String, inLocal: Bool, root: String,
+ visited: inout Set<String>, into out: inout [Entry]) {
+ guard visited.insert(dir).inserted else { return }
+ let fm = FileManager.default
+ out.append(Entry(source: URL(fileURLWithPath: dir), path: path, isDirectory: true, bytes: 0))
+ for name in ((try? fm.contentsOfDirectory(atPath: dir)) ?? []).sorted() {
+ guard let real = inside(URL(fileURLWithPath: dir).appending(path: name), root: root) else { continue }
+ var isDir: ObjCBool = false
+ guard fm.fileExists(atPath: real, isDirectory: &isDir) else { continue }
+ if isDir.boolValue {
+ let lower = name.lowercased()
+ if skippedNames.contains(lower) || (inLocal && skippedInLocal.contains(lower)) { continue }
+ walk(real, path: "\(path)/\(name)", inLocal: false, root: root, visited: &visited, into: &out)
+ } else {
+ let size = ((try? fm.attributesOfItem(atPath: real))?[.size] as? NSNumber)?.int64Value ?? 0
+ out.append(Entry(source: URL(fileURLWithPath: real), path: "\(path)/\(name)", isDirectory: false, bytes: size))
+ }
+ }
+ }
+
+ /// The real path of `url` with every link resolved, or nil when it leads to nothing or out
+ /// of the environment.
+ private static func inside(_ url: URL, root: String) -> String? {
+ guard let real = realPath(url), real == root || real.hasPrefix(root + "/") else { return nil }
+ return real
+ }
+
+ private static func realPath(_ url: URL) -> String? {
+ guard let resolved = realpath(url.path, nil) else { return nil }
+ defer { free(resolved) }
+ return String(cString: resolved)
+ }
+}
diff --git a/Sources/HighballKit/Paths.swift b/Sources/HighballKit/Paths.swift
index 9993898..dccc3a4 100644
--- a/Sources/HighballKit/Paths.swift
+++ b/Sources/HighballKit/Paths.swift
@@ -164,6 +164,9 @@ public struct HighballPaths: Sendable {
/// than `~/.Trash` so the move is always same-filesystem — `rename(2)` cannot cross one,
/// and Finder could not empty an undeletable prefix anyway.
public var trash: URL { home.appending(path: ".trash", directoryHint: .isDirectory) }
+ /// Copies of game saves Highball made before deleting something that held them, made on
+ /// demand and never cleared by Highball.
+ public var saveBackups: URL { home.appending(path: "save-backups", directoryHint: .isDirectory) }
public func engine(_ id: String) -> URL { engines.appending(path: id, directoryHint: .isDirectory) }
public func bottle(_ name: String) -> URL { bottles.appending(path: name, directoryHint: .isDirectory) }
diff --git a/Sources/HighballKit/UserFolders.swift b/Sources/HighballKit/UserFolders.swift
index 9107e09..83ff512 100644
--- a/Sources/HighballKit/UserFolders.swift
+++ b/Sources/HighballKit/UserFolders.swift
@@ -86,12 +86,4 @@ public enum UserFolders {
try userDirectories(driveC: driveC).flatMap { try set(inside: inside, userDirectory: $0, host: host) }
}
- /// True when a user directory holds a Documents folder inside with something in it: what a
- /// deletion would take with it.
- public static func hasFilesInside(driveC: URL) -> Bool {
- userDirectories(driveC: driveC).contains { dir in
- guard shape(userDirectory: dir) == .inside else { return false }
- return !((try? FileManager.default.contentsOfDirectory(atPath: dir.appending(path: folder).path)) ?? []).isEmpty
- }
- }
}
diff --git a/Tests/HighballKitTests/EnvironmentSavesTests.swift b/Tests/HighballKitTests/EnvironmentSavesTests.swift
new file mode 100644
index 0000000..2b2d143
--- /dev/null
+++ b/Tests/HighballKitTests/EnvironmentSavesTests.swift
@@ -0,0 +1,118 @@
+import XCTest
+@testable import HighballKit
+
+/// Keeping an environment's saves before it is deleted: the right folders, nothing bulky, links
+/// followed only inside the environment, and a copy that is whole or absent.
+final class EnvironmentSavesTests: XCTestCase {
+ private var root: URL!
+ private var env: URL!
+ private var user: URL!
+ private var macHome: URL!
+ private var backups: URL!
+ private let fm = FileManager.default
+
+ override func setUpWithError() throws {
+ root = fm.temporaryDirectory.appending(path: "envsaves-\(UUID().uuidString)")
+ env = root.appending(path: "bottles/Games")
+ user = env.appending(path: "drive_c/users/tester")
+ macHome = root.appending(path: "mac-home")
+ backups = root.appending(path: "save-backups")
+ try fm.createDirectory(at: user, withIntermediateDirectories: true)
+ try fm.createDirectory(at: env.appending(path: "drive_c/users/Public/Documents"), withIntermediateDirectories: true)
+ try fm.createDirectory(at: macHome.appending(path: "Documents"), withIntermediateDirectories: true)
+ }
+
+ override func tearDownWithError() throws {
+ try? fm.removeItem(at: root)
+ }
+
+ private func write(_ path: String, in dir: URL, bytes: Int = 1) throws {
+ let url = dir.appending(path: path)
+ try fm.createDirectory(at: url.deletingLastPathComponent(), withIntermediateDirectories: true)
+ try Data(repeating: 0x78, count: bytes).write(to: url)
+ }
+
+ private func files() -> [String] {
+ EnvironmentSaves.entries(environment: env).filter { !$0.isDirectory }.map(\.path).sorted()
+ }
+
+ func testKeepsTheSaveFoldersAndLeavesOutTheBulk() throws {
+ try write("Saved Games/Remedy/Control/save1.sav", in: user)
+ try write("AppData/Roaming/Game/profile.cfg", in: user)
+ try write("AppData/LocalLow/Studio/Game/slot.dat", in: user)
+ try write("AppData/Local/Game/Saved/SaveGames/0.sav", in: user)
+ try write("AppData/Local/Game/ShaderCache/big.bin", in: user)
+ try write("AppData/Local/Game/Saved/Logs/game.log", in: user)
+ try write("AppData/Local/Steam/htmlcache/index", in: user)
+ try write("AppData/Local/Steam/config.vdf", in: user)
+ try write("AppData/Local/Microsoft/Windows/x.dat", in: user)
+ try write("AppData/Local/Temp/setup.tmp", in: user)
+ try write("AppData/Roaming/Other/GPUCache/data_0", in: user)
+ try write("AppData/Roaming/Microsoft/settings.dat", in: user)
+ try write("Contacts/x.contact", in: user)
+ XCTAssertEqual(files(), [
+ "tester/AppData/Local/Game/Saved/SaveGames/0.sav",
+ "tester/AppData/LocalLow/Studio/Game/slot.dat",
+ "tester/AppData/Roaming/Game/profile.cfg",
+ "tester/AppData/Roaming/Microsoft/settings.dat",
+ "tester/Saved Games/Remedy/Control/save1.sav",
+ ], "Steam and Microsoft are left out under Local only")
+ }
+
+ func testDocumentsCountsOnlyWhenItIsInside() throws {
+ try write("My Games/mac.sav", in: macHome.appending(path: "Documents"))
+ try fm.createSymbolicLink(at: user.appending(path: "Documents"), withDestinationURL: macHome.appending(path: "Documents"))
+ XCTAssertEqual(files(), [], "the link to the Mac's Documents is never walked")
+ try fm.removeItem(at: user.appending(path: "Documents"))
+ try write("Documents/My Games/inside.sav", in: user)
+ XCTAssertEqual(files(), ["tester/Documents/My Games/inside.sav"])
+ }
+
+ func testLinksAreFollowedOnlyInsideTheEnvironmentAndLoopsOnce() throws {
+ let roaming = user.appending(path: "AppData/Roaming")
+ try write("Game/a.sav", in: roaming)
+ try write("drive_c/GameData/saves/b.sav", in: env)
+ try write("secret.txt", in: macHome)
+ try fm.createSymbolicLink(at: roaming.appending(path: "Linked"), withDestinationURL: env.appending(path: "drive_c/GameData/saves"))
+ try fm.createSymbolicLink(at: roaming.appending(path: "Home"), withDestinationURL: macHome)
+ try fm.createSymbolicLink(at: roaming.appending(path: "Gone"), withDestinationURL: env.appending(path: "nowhere"))
+ try fm.createSymbolicLink(at: roaming.appending(path: "Game/Loop"), withDestinationURL: roaming)
+ try fm.createSymbolicLink(at: roaming.appending(path: "Game/one.sav"), withDestinationURL: roaming.appending(path: "Game/a.sav"))
+ XCTAssertEqual(files(), [
+ "tester/AppData/Roaming/Game/a.sav",
+ "tester/AppData/Roaming/Game/one.sav",
+ "tester/AppData/Roaming/Linked/b.sav",
+ ])
+ }
+
+ func testKeepCopiesCompleteUnderTheDatedName() throws {
+ try write("Saved Games/Game/save.sav", in: user, bytes: 10)
+ try write("AppData/Roaming/Game/cfg.ini", in: user, bytes: 5)
+ XCTAssertEqual(EnvironmentSaves.bytes(environment: env), 15)
+ let date = Date(timeIntervalSince1970: 1_800_000_000)
+ let kept = try XCTUnwrap(try EnvironmentSaves.keep(environment: env, name: "Games", backups: backups, date: date))
+ XCTAssertEqual(kept.bytes, 15)
+ XCTAssertEqual(kept.folder.deletingLastPathComponent().lastPathComponent, "environments")
+ XCTAssertTrue(kept.folder.lastPathComponent.hasPrefix("Games-2027-01-"))
+ XCTAssertEqual(try Data(contentsOf: kept.folder.appending(path: "tester/Saved Games/Game/save.sav")).count, 10)
+ XCTAssertTrue(fm.fileExists(atPath: kept.folder.appending(path: "tester/AppData/Roaming/Game/cfg.ini").path))
+ XCTAssertEqual(try fm.contentsOfDirectory(atPath: kept.folder.deletingLastPathComponent().path), [kept.folder.lastPathComponent], "no .partial left behind")
+ }
+
+ func testNothingToKeepMakesNoFolder() throws {
+ try fm.createDirectory(at: user.appending(path: "Saved Games"), withIntermediateDirectories: true)
+ XCTAssertNil(try EnvironmentSaves.keep(environment: env, name: "Games", backups: backups))
+ XCTAssertFalse(fm.fileExists(atPath: backups.path))
+ }
+
+ func testAFailedCopyLeavesNothingAndSaysWhy() throws {
+ try write("Saved Games/Game/save.sav", in: user)
+ try fm.createDirectory(at: backups.appending(path: "environments"), withIntermediateDirectories: true)
+ try fm.setAttributes([.posixPermissions: 0o500], ofItemAtPath: backups.appending(path: "environments").path)
+ defer { try? fm.setAttributes([.posixPermissions: 0o700], ofItemAtPath: backups.appending(path: "environments").path) }
+ XCTAssertThrowsError(try EnvironmentSaves.keep(environment: env, name: "Games", backups: backups)) { error in
+ XCTAssertTrue("\(error)".contains("was not deleted"))
+ }
+ XCTAssertEqual(try fm.contentsOfDirectory(atPath: backups.appending(path: "environments").path), [])
+ }
+}
diff --git a/Tests/HighballKitTests/UserFoldersTests.swift b/Tests/HighballKitTests/UserFoldersTests.swift
index 3f3fabc..9b2e5dc 100644
--- a/Tests/HighballKitTests/UserFoldersTests.swift
+++ b/Tests/HighballKitTests/UserFoldersTests.swift
@@ -33,7 +33,6 @@ final class UserFoldersTests: XCTestCase {
func testStartsLinkedAndOnlyRealUsersCount() {
XCTAssertEqual(UserFolders.shape(userDirectory: user), .linked(to: host.path))
XCTAssertEqual(UserFolders.userDirectories(driveC: driveC).map(\.lastPathComponent), ["tester"], "Public is Wine's, never touched")
- XCTAssertFalse(UserFolders.hasFilesInside(driveC: driveC))
}
func testInsideReplacesTheLinkAndLeavesHostFilesWhereTheyAre() throws {
@@ -50,12 +49,10 @@ final class UserFoldersTests: XCTestCase {
func testBackToLinkedKeepsTheInsideFolderWhenItHasFiles() throws {
try UserFolders.set(inside: true, driveC: driveC, host: host)
try write("save.es3", in: user.appending(path: "Documents"))
- XCTAssertTrue(UserFolders.hasFilesInside(driveC: driveC))
let notes = try UserFolders.set(inside: false, driveC: driveC, host: host)
XCTAssertEqual(notes.count, 2)
XCTAssertEqual(UserFolders.shape(userDirectory: user), .linked(to: host.path))
XCTAssertTrue(FileManager.default.fileExists(atPath: user.appending(path: "Documents (environment)/save.es3").path), "nothing is deleted silently")
- XCTAssertFalse(UserFolders.hasFilesInside(driveC: driveC))
}
func testBackToLinkedDropsAnEmptyInsideFolder() throws {