ios get data dir
Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
parent
60d0b9209b
commit
387a7f2df4
@ -151,7 +151,7 @@ hound = "3.5"
|
|||||||
name = "RustDesk"
|
name = "RustDesk"
|
||||||
identifier = "com.carriez.rustdesk"
|
identifier = "com.carriez.rustdesk"
|
||||||
icon = ["res/32x32.png", "res/128x128.png", "res/128x128@2x.png"]
|
icon = ["res/32x32.png", "res/128x128.png", "res/128x128@2x.png"]
|
||||||
deb_depends = ["libgtk-3-0", "libxcb-randr0", "libxdo3", "libxfixes3", "libxcb-shape0", "libxcb-xfixes0", "libasound2", "libsystemd0", "curl", "libappindicator3-1", "libvdpau1", "libva2"]
|
deb_depends = ["libgtk-3-0", "libxcb-randr0", "libxdo3", "libxfixes3", "libxcb-shape0", "libxcb-xfixes0", "libasound2", "libsystemd0", "curl", "libvdpau1", "libva2"]
|
||||||
osx_minimum_system_version = "10.14"
|
osx_minimum_system_version = "10.14"
|
||||||
resources = ["res/mac-tray-light.png","res/mac-tray-dark.png"]
|
resources = ["res/mac-tray-light.png","res/mac-tray-dark.png"]
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ Please download sciter dynamic library yourself.
|
|||||||
```sh
|
```sh
|
||||||
sudo apt install -y zip g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev \
|
sudo apt install -y zip g++ gcc git curl wget nasm yasm libgtk-3-dev clang libxcb-randr0-dev libxdo-dev \
|
||||||
libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake make \
|
libxfixes-dev libxcb-shape0-dev libxcb-xfixes0-dev libasound2-dev libpulse-dev cmake make \
|
||||||
libclang-dev ninja-build libappindicator3-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
libclang-dev ninja-build libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
|
||||||
```
|
```
|
||||||
|
|
||||||
### openSUSE Tumbleweed
|
### openSUSE Tumbleweed
|
||||||
|
2
build.py
2
build.py
@ -217,7 +217,7 @@ Version: %s
|
|||||||
Architecture: amd64
|
Architecture: amd64
|
||||||
Maintainer: open-trade <info@rustdesk.com>
|
Maintainer: open-trade <info@rustdesk.com>
|
||||||
Homepage: https://rustdesk.com
|
Homepage: https://rustdesk.com
|
||||||
Depends: libgtk-3-0, libxcb-randr0, libxdo3, libxfixes3, libxcb-shape0, libxcb-xfixes0, libasound2, libsystemd0, curl, libappindicator3-1, libva-drm2, libva-x11-2, libvdpau1, libgstreamer-plugins-base1.0-0
|
Depends: libgtk-3-0, libxcb-randr0, libxdo3, libxfixes3, libxcb-shape0, libxcb-xfixes0, libasound2, libsystemd0, curl, libva-drm2, libva-x11-2, libvdpau1, libgstreamer-plugins-base1.0-0
|
||||||
Description: A remote control software.
|
Description: A remote control software.
|
||||||
|
|
||||||
""" % version
|
""" % version
|
||||||
|
@ -29,6 +29,7 @@ typedef HandleEvent = Future<void> Function(Map<String, dynamic> evt);
|
|||||||
/// Hides the platform differences.
|
/// Hides the platform differences.
|
||||||
class PlatformFFI {
|
class PlatformFFI {
|
||||||
String _dir = '';
|
String _dir = '';
|
||||||
|
// _homeDir is only needed for Android and IOS.
|
||||||
String _homeDir = '';
|
String _homeDir = '';
|
||||||
F2? _translate;
|
F2? _translate;
|
||||||
final _eventHandlers = <String, Map<String, HandleEvent>>{};
|
final _eventHandlers = <String, Map<String, HandleEvent>>{};
|
||||||
@ -119,8 +120,10 @@ class PlatformFFI {
|
|||||||
if (isAndroid) {
|
if (isAndroid) {
|
||||||
// only support for android
|
// only support for android
|
||||||
_homeDir = (await ExternalPath.getExternalStorageDirectories())[0];
|
_homeDir = (await ExternalPath.getExternalStorageDirectories())[0];
|
||||||
|
} else if (isIOS) {
|
||||||
|
_homeDir = _ffiBind.mainGetDataDirIos();
|
||||||
} else {
|
} else {
|
||||||
_homeDir = (await getDownloadsDirectory())?.path ?? '';
|
// no need to set home dir
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
debugPrint('initialize failed: $e');
|
debugPrint('initialize failed: $e');
|
||||||
@ -159,8 +162,13 @@ class PlatformFFI {
|
|||||||
name = macOsInfo.computerName;
|
name = macOsInfo.computerName;
|
||||||
id = macOsInfo.systemGUID ?? '';
|
id = macOsInfo.systemGUID ?? '';
|
||||||
}
|
}
|
||||||
debugPrint(
|
if (isAndroid || isIOS) {
|
||||||
'_appType:$_appType,info1-id:$id,info2-name:$name,dir:$_dir,homeDir:$_homeDir');
|
debugPrint(
|
||||||
|
'_appType:$_appType,info1-id:$id,info2-name:$name,dir:$_dir,homeDir:$_homeDir');
|
||||||
|
} else {
|
||||||
|
debugPrint(
|
||||||
|
'_appType:$_appType,info1-id:$id,info2-name:$name,dir:$_dir');
|
||||||
|
}
|
||||||
await _ffiBind.mainDeviceId(id: id);
|
await _ffiBind.mainDeviceId(id: id);
|
||||||
await _ffiBind.mainDeviceName(name: name);
|
await _ffiBind.mainDeviceName(name: name);
|
||||||
await _ffiBind.mainSetHomeDir(home: _homeDir);
|
await _ffiBind.mainSetHomeDir(home: _homeDir);
|
||||||
|
@ -1,32 +0,0 @@
|
|||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:tray_manager/tray_manager.dart';
|
|
||||||
|
|
||||||
import '../common.dart';
|
|
||||||
|
|
||||||
const kTrayItemShowKey = "show";
|
|
||||||
const kTrayItemQuitKey = "quit";
|
|
||||||
|
|
||||||
Future<void> initTray({List<MenuItem>? extra_item}) async {
|
|
||||||
List<MenuItem> items = [
|
|
||||||
MenuItem(key: kTrayItemShowKey, label: translate("Show RustDesk")),
|
|
||||||
MenuItem.separator(),
|
|
||||||
MenuItem(key: kTrayItemQuitKey, label: translate("Quit")),
|
|
||||||
];
|
|
||||||
if (extra_item != null) {
|
|
||||||
items.insertAll(0, extra_item);
|
|
||||||
}
|
|
||||||
if (Platform.isMacOS || Platform.isWindows) {
|
|
||||||
await trayManager.setToolTip("rustdesk");
|
|
||||||
}
|
|
||||||
if (Platform.isMacOS || Platform.isLinux) {
|
|
||||||
await trayManager.setTitle("rustdesk");
|
|
||||||
}
|
|
||||||
await trayManager
|
|
||||||
.setIcon(Platform.isWindows ? "assets/logo.ico" : "assets/logo.png");
|
|
||||||
await trayManager.setContextMenu(Menu(items: items));
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> destoryTray() async {
|
|
||||||
return trayManager.destroy();
|
|
||||||
}
|
|
@ -57,6 +57,10 @@ lazy_static::lazy_static! {
|
|||||||
|
|
||||||
lazy_static::lazy_static! {
|
lazy_static::lazy_static! {
|
||||||
pub static ref APP_DIR: Arc<RwLock<String>> = Default::default();
|
pub static ref APP_DIR: Arc<RwLock<String>> = Default::default();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||||
|
lazy_static::lazy_static! {
|
||||||
pub static ref APP_HOME_DIR: Arc<RwLock<String>> = Default::default();
|
pub static ref APP_HOME_DIR: Arc<RwLock<String>> = Default::default();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,8 +967,22 @@ pub fn session_change_prefer_codec(id: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_set_home_dir(home: String) {
|
pub fn main_set_home_dir(_home: String) {
|
||||||
*config::APP_HOME_DIR.write().unwrap() = home;
|
#[cfg(any(target_os = "android", target_os = "ios"))]
|
||||||
|
{
|
||||||
|
*config::APP_HOME_DIR.write().unwrap() = _home;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is a temporary method to get data dir for ios
|
||||||
|
pub fn main_get_data_dir_ios() -> SyncReturn<String> {
|
||||||
|
let data_dir = config::Config::path("data");
|
||||||
|
if !data_dir.exists() {
|
||||||
|
if let Err(e) = std::fs::create_dir_all(&data_dir) {
|
||||||
|
log::warn!("Failed to create data dir {}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SyncReturn(data_dir.to_string_lossy().to_string())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn main_stop_service() {
|
pub fn main_stop_service() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user