mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-29 14:04:19 +03:00
fix(cli): missing assets dir on iOS project when it is committed (#7765)
This commit is contained in:
parent
b7f53d66e8
commit
8faa5a4a12
6
.changes/ios-create-asset-dir.md
Normal file
6
.changes/ios-create-asset-dir.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"tauri-cli": patch:bug
|
||||
"@tauri-apps/cli": patch:bug
|
||||
---
|
||||
|
||||
Ensure asset directory exists on the iOS project.
|
@ -20,7 +20,7 @@ use tauri_mobile::{
|
||||
env::Env,
|
||||
target::Target,
|
||||
},
|
||||
config::app::App,
|
||||
config::app::{App, DEFAULT_ASSET_DIR},
|
||||
opts::{FilterLevel, NoiseLevel},
|
||||
os,
|
||||
util::prompt,
|
||||
@ -292,7 +292,10 @@ fn open_and_wait(config: &AndroidConfig, env: &Env) -> ! {
|
||||
}
|
||||
|
||||
fn inject_assets(config: &AndroidConfig, tauri_config: &TauriConfig) -> Result<()> {
|
||||
let asset_dir = config.project_dir().join("app/src/main/assets");
|
||||
let asset_dir = config
|
||||
.project_dir()
|
||||
.join("app/src/main")
|
||||
.join(DEFAULT_ASSET_DIR);
|
||||
create_dir_all(&asset_dir)?;
|
||||
|
||||
write(
|
||||
|
@ -15,7 +15,7 @@ use tauri_mobile::{
|
||||
target::Target,
|
||||
teams::find_development_teams,
|
||||
},
|
||||
config::app::App,
|
||||
config::app::{App, DEFAULT_ASSET_DIR},
|
||||
env::Env,
|
||||
opts::NoiseLevel,
|
||||
os,
|
||||
@ -30,7 +30,7 @@ use super::{
|
||||
};
|
||||
use crate::{helpers::config::Config as TauriConfig, Result};
|
||||
|
||||
use std::{env::set_var, process::exit, thread::sleep, time::Duration};
|
||||
use std::{env::set_var, fs::create_dir_all, process::exit, thread::sleep, time::Duration};
|
||||
|
||||
mod build;
|
||||
mod dev;
|
||||
@ -256,3 +256,9 @@ fn open_and_wait(config: &AppleConfig, env: &Env) -> ! {
|
||||
sleep(Duration::from_secs(24 * 60 * 60));
|
||||
}
|
||||
}
|
||||
|
||||
fn inject_assets(config: &AppleConfig) -> Result<()> {
|
||||
let asset_dir = config.project_dir().join(DEFAULT_ASSET_DIR);
|
||||
create_dir_all(asset_dir)?;
|
||||
Ok(())
|
||||
}
|
||||
|
@ -3,8 +3,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use super::{
|
||||
configure_cargo, detect_target_ok, ensure_init, env, get_app, get_config, log_finished,
|
||||
open_and_wait, MobileTarget,
|
||||
configure_cargo, detect_target_ok, ensure_init, env, get_app, get_config, inject_assets,
|
||||
log_finished, open_and_wait, MobileTarget,
|
||||
};
|
||||
use crate::{
|
||||
build::Options as BuildOptions,
|
||||
@ -91,6 +91,7 @@ pub fn command(mut options: Options, noise_level: NoiseLevel) -> Result<()> {
|
||||
set_current_dir(tauri_path).with_context(|| "failed to change current working directory")?;
|
||||
|
||||
ensure_init(config.project_dir(), MobileTarget::Ios)?;
|
||||
inject_assets(&config)?;
|
||||
|
||||
let mut env = env()?;
|
||||
configure_cargo(&app, None)?;
|
||||
|
@ -3,8 +3,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use super::{
|
||||
configure_cargo, device_prompt, ensure_init, env, get_app, get_config, open_and_wait,
|
||||
setup_dev_config, MobileTarget, APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME,
|
||||
configure_cargo, device_prompt, ensure_init, env, get_app, get_config, inject_assets,
|
||||
open_and_wait, setup_dev_config, MobileTarget, APPLE_DEVELOPMENT_TEAM_ENV_VAR_NAME,
|
||||
};
|
||||
use crate::{
|
||||
dev::Options as DevOptions,
|
||||
@ -139,6 +139,7 @@ fn run_command(mut options: Options, noise_level: NoiseLevel) -> Result<()> {
|
||||
set_current_dir(tauri_path).with_context(|| "failed to change current working directory")?;
|
||||
|
||||
ensure_init(config.project_dir(), MobileTarget::Ios)?;
|
||||
inject_assets(&config)?;
|
||||
run_dev(options, tauri_config, &app, &config, noise_level)
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
use super::{ensure_init, env, get_app, get_config, MobileTarget};
|
||||
use super::{ensure_init, env, get_app, get_config, inject_assets, MobileTarget};
|
||||
use crate::{helpers::config::get as get_tauri_config, Result};
|
||||
|
||||
use tauri_mobile::os;
|
||||
@ -17,6 +17,7 @@ pub fn command() -> Result<()> {
|
||||
};
|
||||
|
||||
ensure_init(config.project_dir(), MobileTarget::Ios)?;
|
||||
inject_assets(&config)?;
|
||||
let env = env()?;
|
||||
os::open_file_with("Xcode", config.project_dir(), &env).map_err(Into::into)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user