Play your own Switch games on iPhone/iPad — one-click macOS app, no terminal. | 把 Switch 游戏装进 iPhone:图形界面一键构建,不用命令行。Bring your own game.
Swift apple-siliconcustom-formathomebrewiosipaipadipadosiphonemetalnative-portnintendo-switchnxnativeromfsswitch-games
Patch queue: absorb the xcode_projects.py PermissionError fix (PR #171)
LNPANDYcd1bf88cde80
diff --git a/patches/0004-ios-slim-ipa.patch b/patches/0004-ios-slim-ipa.patchindex 12c4107f..4b146a3b 100644--- a/patches/0004-ios-slim-ipa.patch+++ b/patches/0004-ios-slim-ipa.patch@@ -12,11 +12,12 @@ Upstream-Status: fork-only (upstream has the opt-in DM_COPY_ROMFS=NO since 32ae3Reason: Default slim IPA: the RomFS and aoc/ stay out unless DM_FULL_ROMFS=1 (a full package of a large game is many GB and iOS refuses it). Upstream took the opt-out DM_COPY_ROMFS=NO and kept the full package as its defaultIssue: LNPANDY/NX2Apple#123---- dm/ios/tests/test_ipa_unsigned.py | 13 +++++++++----+ dm/ios/tests/test_ipa_unsigned.py | 13 ++++++++----dm/ios/tests/test_profile_pack.py | 3 ++-- dm/ios/tools/build_ipa.sh | 9 ++++++++-+ dm/ios/tools/build_ipa.sh | 9 +++++++-+ dm/ios/tools/xcode_projects.py | 34 ++++++++++++++++++++++++++++++-docs/env_switches.tsv | 1 +- 4 files changed, 20 insertions(+), 6 deletions(-)+ 5 files changed, 53 insertions(+), 7 deletions(-)diff --git a/dm/ios/tests/test_ipa_unsigned.py b/dm/ios/tests/test_ipa_unsigned.pyindex 028d5067..42086883 100644@@ -98,6 +99,54 @@ index e2c174d1..3d8f5c73 100755if [ -n "${PSO:-}" ]; then MAPS+=("$P/pso=$PSO"); fiMAPS+=("$P/msl/$MSLDIR=$MSL_IOS/$MSLDIR" "$P=$APP")t "pack IPA (already-compressed game files stored, everything else deflated)"+diff --git a/dm/ios/tools/xcode_projects.py b/dm/ios/tools/xcode_projects.py+index a832ad5a..0f5485df 100644+--- a/dm/ios/tools/xcode_projects.py++++ b/dm/ios/tools/xcode_projects.py+@@ -33,10 +33,42 @@ def workspace_projects(workspace):+ if kind == 'absolute': yield Path(path).resolve()++++def prune_unreadable(workspace):++ """Remove workspace entries the current user cannot access, and save the file.++++ The workspace records absolute paths, and the launcher's saved state crosses accounts on a++ shared Mac: a new user's build inherits the first user's entries and dies with PermissionError++ when it stats them. A project this user cannot read is not this user's project — removing the++ entry is the fix, not a message telling them to edit XML."""++ path = Path(workspace) / 'contents.xcworkspacedata'++ if not path.exists(): return 0++ tree = workspace_tree(workspace)++ removed = 0++ for group in tree.iter('Group'):++ for ref in list(group.findall('FileRef')):++ kind, _, loc = ref.get('location', '').partition(':')++ if kind != 'absolute': continue++ try:++ Path(loc).exists()++ continue # the current user can read it: a real project, not a stale entry++ except (PermissionError, OSError):++ pass++ group.remove(ref)++ removed += 1++ if removed:++ tree.write(str(path), xml_declaration=True, encoding='unicode')++ print(f'[NOTE] removed {removed} workspace entr{"y" if removed == 1 else "ies"} the current user cannot read (registered by another macOS user)')++ return removed+++++ def check_bundle_id(workspace, project, bundle_id):++ prune_unreadable(workspace)+ for other in workspace_projects(workspace):+ if other == Path(project).resolve() or not other.exists(): continue+- used = signing_settings(other).get('PRODUCT_BUNDLE_IDENTIFIER', '')++ try:++ used = signing_settings(other).get('PRODUCT_BUNDLE_IDENTIFIER', '')++ except (PermissionError, OSError):++ continue+ if used.lower() == bundle_id.lower():+ raise ValueError(f'bundle ID {bundle_id} is already used by {other}; choose a different --bundle-id for this game')+diff --git a/docs/env_switches.tsv b/docs/env_switches.tsvindex b427084e..4b731480 100644--- a/docs/env_switches.tsv