Last active
September 13, 2022 14:20
-
-
Save artemnovichkov/8d739537a8d4f91dc67e70856d194311 to your computer and use it in GitHub Desktop.
Explore Documents folder in Files.app. Inspired by Ole's tweet https://twitter.com/olebegemann/status/987346188591681536
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env xcrun --sdk macosx swift | |
import Foundation | |
enum Configuration: String { | |
case debug = "Debug" | |
case release = "Release" | |
} | |
// Get Info.plist path | |
guard let productSettingsPathRawValue = getenv("PRODUCT_SETTINGS_PATH"), | |
let productSettingsPath = String(utf8String: productSettingsPathRawValue) else { | |
exit(1) | |
} | |
guard let configurationRawValue = getenv("CONFIGURATION"), | |
let configurationString = String(utf8String: configurationRawValue), | |
let configuration = Configuration(rawValue: configurationString) else { | |
exit(1) | |
} | |
// Check product settings | |
guard let productSettings = NSMutableDictionary(contentsOfFile: productSettingsPath) else { | |
exit(1) | |
} | |
switch configuration { | |
case .debug: | |
productSettings["LSSupportsOpeningDocumentsInPlace"] = true | |
productSettings["UIFileSharingEnabled"] = true | |
case .release: | |
productSettings["LSSupportsOpeningDocumentsInPlace"] = nil | |
productSettings["UIFileSharingEnabled"] = nil | |
} | |
productSettings.write(toFile: productSettingsPath, atomically: true) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment