Skip to content

An open-source remote desktop application designed for self-hosting, as an alternative to TeamViewer.

fix: ios, file transfer, home dir (#12657)

fufesou0b9d7925b52b
diff --git a/flutter/lib/models/native_model.dart b/flutter/lib/models/native_model.dart
index 337f53278..b57867838 100644
--- a/flutter/lib/models/native_model.dart
+++ b/flutter/lib/models/native_model.dart
@@ -156,7 +156,10 @@ class PlatformFFI {
// only support for android
_homeDir = (await ExternalPath.getExternalStorageDirectories())[0];
} else if (isIOS) {
- _homeDir = _ffiBind.mainGetDataDirIos();
+ // The previous code was `_homeDir = (await getDownloadsDirectory())?.path ?? '';`,
+ // which provided the `downloads` path in the sandbox.
+ // It is unclear why we now use the `data` directory in the sandbox instead.
+ _homeDir = _ffiBind.mainGetDataDirIos(appDir: _dir);
} else {
// no need to set home dir
}
diff --git a/src/flutter_ffi.rs b/src/flutter_ffi.rs
index 3e947609f..3a9587e88 100644
--- a/src/flutter_ffi.rs
+++ b/src/flutter_ffi.rs
@@ -37,7 +37,11 @@ lazy_static::lazy_static! {
fn initialize(app_dir: &str, custom_client_config: &str) {
flutter::async_tasks::start_flutter_async_runner();
- *config::APP_DIR.write().unwrap() = app_dir.to_owned();
+ // `APP_DIR` is set in `main_get_data_dir_ios()` on iOS.
+ #[cfg(not(target_os = "ios"))]
+ {
+ *config::APP_DIR.write().unwrap() = app_dir.to_owned();
+ }
// core_main's load_custom_client does not work for flutter since it is only applied to its load_library in main.c
if custom_client_config.is_empty() {
crate::load_custom_client();
@@ -1802,7 +1806,8 @@ pub fn main_set_home_dir(_home: String) {
}
// This is a temporary method to get data dir for ios
-pub fn main_get_data_dir_ios() -> SyncReturn<String> {
+pub fn main_get_data_dir_ios(app_dir: String) -> SyncReturn<String> {
+ *config::APP_DIR.write().unwrap() = app_dir;
let data_dir = config::Config::path("data");
if !data_dir.exists() {
if let Err(e) = std::fs::create_dir_all(&data_dir) {