snapshot/lib/assets/SnapshotHelper2-3.swift in fastlane-2.24.0.beta.20170327010009 vs snapshot/lib/assets/SnapshotHelper2-3.swift in fastlane-2.24.0.beta.20170328010037

- old
+ new

@@ -100,10 +100,12 @@ sleep(1) // Waiting for the animation to be finished (kind of) #if os(tvOS) XCUIApplication().childrenMatchingType(.Browser).count + #elseif os(OSX) + XCUIApplication().typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) #else XCUIDevice.sharedDevice().orientation = .Unknown #endif } @@ -119,15 +121,33 @@ print("Waiting for loading indicator to disappear...") } } class func pathPrefix() -> NSString? { - if let path = NSProcessInfo().environment["SIMULATOR_HOST_HOME"] as NSString? { - return path.stringByAppendingPathComponent("Library/Caches/tools.fastlane") - } - print("Couldn't find Snapshot configuration files at ~/Library/Caches/tools.fastlane") - return nil + var homeDir: NSString + //on OSX config is stored in /Users/<username>/Library + //and on iOS/tvOS/WatchOS it's in simulator's home dir + #if os(OSX) + + guard let user = ProcessInfo().environment["USER"] else { + print("Couldn't find Snapshot configuration files - can't detect current user ") + return nil + } + + guard let usersDir = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.NSUserDirectory, NSSearchPathDomainMask.NSLocalDomainMask, true)[0] as NSString? else { + print("Couldn't find Snapshot configuration files - can't detect `Users` dir") + return nil + } + + homeDir = usersDir.stringByAppendingPathComponent(user) as NSString + #else + guard homeDir = ProcessInfo().environment["SIMULATOR_HOST_HOME"] as NSString else { + print("Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable.") + return nil + } + #endif + return homeDir.stringByAppendingPathComponent("Library/Caches/tools.fastlane") as NSString } } extension XCUIElement { var isLoadingIndicator: Bool { @@ -139,6 +159,6 @@ } } // Please don't remove the lines below // They are used to detect outdated configuration files -// SnapshotHelperVersion [1.2] +// SnapshotHelperVersion [1.3]