diff --git a/Build.xcconfig b/Build.xcconfig
index b15d84b0ec..e3d7050efd 100644
--- a/Build.xcconfig
+++ b/Build.xcconfig
@@ -20,6 +20,7 @@ PRODUCT_NAME = $(TARGET_NAME)
_PRODUCT_BUNDLE_IDENTIFIER_ = $(ORG_PREFIX).$(PROJECT_NAME:lower)
PRODUCT_BUNDLE_IDENTIFIER = $(ORG_PREFIX).$(PROJECT_NAME:lower)
+PRODUCT_BUNDLE_IDENTIFIER_LITE = $(ORG_PREFIX).$(PROJECT_NAME:lower).lite
//PRODUCT_BUNDLE_IDENTIFIER[configuration=Debug] = $(ORG_PREFIX).$(PROJECT_NAME:lower)-debug
APP_GROUP_IDENTIFIER = group.$(ORG_PREFIX).$(PROJECT_NAME:lower)
diff --git a/PVLibrary/Sources/DirectoryWatcher/DirectoryWatcher.swift b/PVLibrary/Sources/DirectoryWatcher/DirectoryWatcher.swift
index 42eacb0953..b901a722e3 100644
--- a/PVLibrary/Sources/DirectoryWatcher/DirectoryWatcher.swift
+++ b/PVLibrary/Sources/DirectoryWatcher/DirectoryWatcher.swift
@@ -505,14 +505,13 @@ extension DirectoryWatcher {
/// Handle an imported file
public func handleImportedFile(at url: URL) {
ILOG("Handling imported file: \(url.lastPathComponent)")
- guard url.startAccessingSecurityScopedResource() else {
- ELOG("Failed to access security scoped resource for file: \(url.lastPathComponent)")
- return
- }
+ let secureDoc = url.startAccessingSecurityScopedResource()
defer {
- url.stopAccessingSecurityScopedResource()
- ILOG("Stopped accessing security scoped resource for file: \(url.lastPathComponent)")
+ if secureDoc {
+ url.stopAccessingSecurityScopedResource()
+ ILOG("Stopped accessing security scoped resource for file: \(url.lastPathComponent)")
+ }
}
let coordinator = NSFileCoordinator()
diff --git a/PVLibrary/Sources/PVLibrary/Importer/iCloud/iCloudSync.swift b/PVLibrary/Sources/PVLibrary/Importer/iCloud/iCloudSync.swift
index a1a0c3b76d..2497029ff6 100644
--- a/PVLibrary/Sources/PVLibrary/Importer/iCloud/iCloudSync.swift
+++ b/PVLibrary/Sources/PVLibrary/Importer/iCloud/iCloudSync.swift
@@ -377,13 +377,13 @@ public enum iCloudSync {
await jsonFiles.concurrentForEach { @MainActor json in
let realm = try! await Realm()
do {
- guard json.startAccessingSecurityScopedResource() else {
- ELOG("startAccessingSecurityScopedResource failed")
- return
- }
+
+ let secureDoc = json.startAccessingSecurityScopedResource()
defer {
- json.stopAccessingSecurityScopedResource()
+ if secureDoc {
+ json.stopAccessingSecurityScopedResource()
+ }
}
var dataMaybe = FileManager.default.contents(atPath: json.path)
diff --git a/PVUI/Sources/PVUIBase/Game Library/PVGameLibraryUpdatesController.swift b/PVUI/Sources/PVUIBase/Game Library/PVGameLibraryUpdatesController.swift
index f1d1c9eff5..0ad120dd5c 100644
--- a/PVUI/Sources/PVUIBase/Game Library/PVGameLibraryUpdatesController.swift
+++ b/PVUI/Sources/PVUIBase/Game Library/PVGameLibraryUpdatesController.swift
@@ -315,11 +315,12 @@ public extension PVGameLibraryUpdatesController {
}
private func copyFileToImports(from sourceURL: URL) {
- guard sourceURL.startAccessingSecurityScopedResource() else {
- ELOG("startAccessingSecurityScopedResource failed for \(sourceURL.path)")
- return
+ let secureDoc = sourceURL.startAccessingSecurityScopedResource()
+ defer {
+ if secureDoc {
+ sourceURL.stopAccessingSecurityScopedResource()
+ }
}
- defer { sourceURL.stopAccessingSecurityScopedResource() }
let destinationURL = Paths.romsImportPath.appendingPathComponent(sourceURL.lastPathComponent)
diff --git a/Provenance.xcodeproj/project.pbxproj b/Provenance.xcodeproj/project.pbxproj
index c5f0768066..12e4dd9eed 100644
--- a/Provenance.xcodeproj/project.pbxproj
+++ b/Provenance.xcodeproj/project.pbxproj
@@ -8973,7 +8973,7 @@
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = dwarf;
- DEVELOPMENT_TEAM = S32Z3HMYVQ;
+ DEVELOPMENT_TEAM = "$(DEVELOPMENT_TEAM)";
ENABLE_HARDENED_RUNTIME = YES;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
FRAMEWORK_SEARCH_PATHS = (
@@ -9025,9 +9025,10 @@
OTHER_CFLAGS = "-Wno-deprecated-declarations";
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-function-bodies=300 -Xfrontend -warn-long-expression-type-checking=200 -DAPP_STORE -DAPPSTORE";
- "PRODUCT_BUNDLE_IDENTIFIER[sdk=appletvos*]" = "org.provenance-emu.provenance.lite";
- "PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = "org.provenance-emu.provenance.lite";
- "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = "org.provenance-emu.provenance.lite";
+ PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
+ "PRODUCT_BUNDLE_IDENTIFIER[sdk=appletvos*]" = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
+ "PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
+ "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
PRODUCT_NAME = "Provenance Lite";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = auto;
@@ -9072,7 +9073,7 @@
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DEVELOPMENT_TEAM = S32Z3HMYVQ;
+ DEVELOPMENT_TEAM = "$(DEVELOPMENT_TEAM)";
ENABLE_HARDENED_RUNTIME = YES;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
FRAMEWORK_SEARCH_PATHS = (
@@ -9127,9 +9128,10 @@
);
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-function-bodies=300 -Xfrontend -warn-long-expression-type-checking=200 -DAPP_STORE -DAPPSTORE";
- "PRODUCT_BUNDLE_IDENTIFIER[sdk=appletvos*]" = "org.provenance-emu.provenance.lite";
- "PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = "org.provenance-emu.provenance.lite";
- "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = "org.provenance-emu.provenance.lite";
+ PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
+ "PRODUCT_BUNDLE_IDENTIFIER[sdk=appletvos*]" = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
+ "PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
+ "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
PRODUCT_NAME = "Provenance Lite";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = auto;
@@ -9170,7 +9172,7 @@
CODE_SIGN_STYLE = Automatic;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- DEVELOPMENT_TEAM = S32Z3HMYVQ;
+ DEVELOPMENT_TEAM = "$(DEVELOPMENT_TEAM)";
ENABLE_HARDENED_RUNTIME = YES;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
FRAMEWORK_SEARCH_PATHS = (
@@ -9225,9 +9227,10 @@
);
OTHER_LDFLAGS = "$(inherited)";
OTHER_SWIFT_FLAGS = "-Xfrontend -warn-long-function-bodies=300 -Xfrontend -warn-long-expression-type-checking=200 -DAPP_STORE -DAPPSTORE";
- "PRODUCT_BUNDLE_IDENTIFIER[sdk=appletvos*]" = "org.provenance-emu.provenance.lite";
- "PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = "org.provenance-emu.provenance.lite";
- "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = "org.provenance-emu.provenance.lite";
+ PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
+ "PRODUCT_BUNDLE_IDENTIFIER[sdk=appletvos*]" = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
+ "PRODUCT_BUNDLE_IDENTIFIER[sdk=iphoneos*]" = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
+ "PRODUCT_BUNDLE_IDENTIFIER[sdk=macosx*]" = "$(PRODUCT_BUNDLE_IDENTIFIER_LITE)";
PRODUCT_NAME = "Provenance Lite";
PROVISIONING_PROFILE_SPECIFIER = "";
SDKROOT = auto;
diff --git a/Provenance/PVAppDelegate+Open.swift b/Provenance/PVAppDelegate+Open.swift
index 1162bdb9da..9437d45b4f 100644
--- a/Provenance/PVAppDelegate+Open.swift
+++ b/Provenance/PVAppDelegate+Open.swift
@@ -132,14 +132,17 @@ extension PVAppDelegate {
func handle(fileURL url: URL, options: [UIApplication.OpenURLOptionsKey: Any] = [:]) -> Bool {
let filename = url.lastPathComponent
let destinationPath = Paths.romsImportPath.appendingPathComponent(filename, isDirectory: false)
-
+ var secureDocument = false
do {
defer {
- url.stopAccessingSecurityScopedResource()
+ if secureDocument {
+ url.stopAccessingSecurityScopedResource()
+ }
+
}
// Doesn't seem we need access in dev builds?
- _ = url.startAccessingSecurityScopedResource()
+ secureDocument = url.startAccessingSecurityScopedResource()
if let openInPlace = options[.openInPlace] as? Bool, openInPlace {
try FileManager.default.copyItem(at: url, to: destinationPath)
diff --git a/Provenance/Provenance-AppStore.entitlements b/Provenance/Provenance-AppStore.entitlements
index dda7bfcc09..6128842c49 100644
--- a/Provenance/Provenance-AppStore.entitlements
+++ b/Provenance/Provenance-AppStore.entitlements
@@ -11,7 +11,7 @@
com.apple.developer.icloud-container-identifiers
- iCloud.org.provenance-emu.provenance
+ $(ICLOUD_CONTAINER_IDENTIFIER)
com.apple.developer.icloud-services
@@ -26,7 +26,7 @@
com.apple.developer.ubiquity-container-identifiers
- iCloud.org.provenance-emu.provenance
+ $(ICLOUD_CONTAINER_IDENTIFIER)
com.apple.developer.ubiquity-kvstore-identifier
$(TeamIdentifierPrefix)$(CFBundleIdentifier)
@@ -34,8 +34,8 @@
com.apple.security.application-groups
- group.org.provenance-emu.provenance
- group.org.provenance-emu
+ $(APP_GROUP_IDENTIFIER).provenance
+ $(APP_GROUP_IDENTIFIER)
com.apple.security.assets.pictures.read-write