Skip to content

Commit 888f93d

Browse files
committed
make APP folder
Signed-off-by: Jordan Hall <[email protected]>
1 parent 6bd9f23 commit 888f93d

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

packages/cli/src/build/request.rs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2584,7 +2584,7 @@ impl BuildRequest {
25842584
create_dir_all(&wrapper)?;
25852585

25862586
// app
2587-
let app = root.join("app");
2587+
let app = self.android_app_dir();
25882588
let app_main = app.join("src").join("main");
25892589
let app_kotlin = app_main.join("kotlin");
25902590
let app_jnilibs = app_main.join("jniLibs");
@@ -2854,10 +2854,22 @@ impl BuildRequest {
28542854
Ok(())
28552855
}
28562856

2857+
/// Helper method to get the Android app directory, handling ejected assets correctly
2858+
fn android_app_dir(&self) -> PathBuf {
2859+
let project_dir = self.workspace.workspace_root();
2860+
let ejected_android_dir = project_dir.join("android");
2861+
let using_ejected_assets = ejected_android_dir.exists();
2862+
2863+
if using_ejected_assets {
2864+
self.root_dir()
2865+
} else {
2866+
self.root_dir().join("app")
2867+
}
2868+
}
2869+
28572870
fn wry_android_kotlin_files_out_dir(&self) -> PathBuf {
28582871
let mut kotlin_dir = self
2859-
.root_dir()
2860-
.join("app")
2872+
.android_app_dir()
28612873
.join("src")
28622874
.join("main")
28632875
.join("kotlin");
@@ -3692,8 +3704,7 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
36923704
}
36933705

36943706
let app_release = self
3695-
.root_dir()
3696-
.join("app")
3707+
.android_app_dir()
36973708
.join("build")
36983709
.join("outputs")
36993710
.join("bundle")
@@ -3728,8 +3739,7 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
37283739
}
37293740

37303741
pub(crate) fn debug_apk_path(&self) -> PathBuf {
3731-
self.root_dir()
3732-
.join("app")
3742+
self.android_app_dir()
37333743
.join("build")
37343744
.join("outputs")
37353745
.join("apk")
@@ -3818,8 +3828,7 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
38183828
.join("assets"),
38193829

38203830
Platform::Android => self
3821-
.root_dir()
3822-
.join("app")
3831+
.android_app_dir()
38233832
.join("src")
38243833
.join("main")
38253834
.join("assets"),
@@ -3851,8 +3860,7 @@ __wbg_init({{module_or_path: "/{}/{wasm_path}"}}).then((wasm) => {{
38513860

38523861
// Android has a whole build structure to it
38533862
Platform::Android => self
3854-
.root_dir()
3855-
.join("app")
3863+
.android_app_dir()
38563864
.join("src")
38573865
.join("main")
38583866
.join("jniLibs")

0 commit comments

Comments
 (0)