Skip to content

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

Shell demo: read art from a DemoArt folder in the app bundle

v0lumehib33a21b30f8c
diff --git a/frontend-ios/.gitignore b/frontend-ios/.gitignore
index fad3453c..b84b4047 100644
--- a/frontend-ios/.gitignore
+++ b/frontend-ios/.gitignore
@@ -9,3 +9,5 @@ QA/
*.jpeg
*.png
*.webp
+# A private build may carry banners in the app bundle (DemoArt/). The images stay out of git, the *.jpg rules above cover them.
+DemoArt/
diff --git a/frontend-ios/Sources/ShellDemo/RealArt.swift b/frontend-ios/Sources/ShellDemo/RealArt.swift
index 3016d933..8a5414da 100644
--- a/frontend-ios/Sources/ShellDemo/RealArt.swift
+++ b/frontend-ios/Sources/ShellDemo/RealArt.swift
@@ -23,6 +23,8 @@ enum RealArt {
static let folders: [URL] = {
let args = ProcessInfo.processInfo.arguments
var folders = args.indices.filter { args[$0] == "--art-dir" && args.indices.contains($0 + 1) }.map { URL(fileURLWithPath: args[$0 + 1]) }
+ // On a device there are no launch arguments: a `DemoArt` folder inside the app bundle works like `--art-dir`.
+ if let bundled = Bundle.main.url(forResource: "DemoArt", withExtension: nil) { folders.append(bundled) }
if args.contains("--real-art") {
let env = ProcessInfo.processInfo.environment
let home = env["SIMULATOR_HOST_HOME"] ?? NSHomeDirectory()