Skip to content

Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.

599 B
Raw Blame
import Foundation

package enum VolumePath {
    /// A path on an external volume (`/Volumes/<name>/...`) whose mount point is absent: the drive is not connected, so the file is
    /// not known to be gone and its path must stay.
    package static func onUnmounted(_ path: String, volumes: String = "/Volumes") -> Bool {
        let prefix = volumes.hasSuffix("/") ? volumes : volumes + "/"
        guard path.hasPrefix(prefix), let name = path.dropFirst(prefix.count).split(separator: "/").first else { return false }
        return !FileManager.default.fileExists(atPath: prefix + name)
    }
}