summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-11-28 08:31:53 +0100
committerRémi Verschelde <rverschelde@gmail.com>2022-11-28 08:31:53 +0100
commit2d1bf5651042b3029b89b1b81a8333ebdb5360fa (patch)
treec6b9b2048bd041493e57c76566d6d48b43d934e6 /platform
parentac2be7c61eec430bdee1c149062b1e7267a22e87 (diff)
parent6bf9594cfb82089b38dd96322bc6231ddb90e856 (diff)
Merge pull request #68740 from bruvzg/ios_fixes
[iOS] Fix getting Unicode executable path, fix error spam on start.
Diffstat (limited to 'platform')
-rw-r--r--platform/ios/os_ios.h1
-rw-r--r--platform/ios/os_ios.mm17
2 files changed, 9 insertions, 9 deletions
diff --git a/platform/ios/os_ios.h b/platform/ios/os_ios.h
index 400040875f..0c23b216c5 100644
--- a/platform/ios/os_ios.h
+++ b/platform/ios/os_ios.h
@@ -106,7 +106,6 @@ public:
virtual Error shell_open(String p_uri) override;
- void set_user_data_dir(String p_dir);
virtual String get_user_data_dir() const override;
virtual String get_cache_path() const override;
diff --git a/platform/ios/os_ios.mm b/platform/ios/os_ios.mm
index b6b94d2f5e..160724618f 100644
--- a/platform/ios/os_ios.mm
+++ b/platform/ios/os_ios.mm
@@ -130,8 +130,6 @@ void OS_IOS::alert(const String &p_alert, const String &p_title) {
void OS_IOS::initialize_core() {
OS_Unix::initialize_core();
-
- set_user_data_dir(user_data_dir);
}
void OS_IOS::initialize() {
@@ -273,13 +271,16 @@ Error OS_IOS::shell_open(String p_uri) {
return OK;
}
-void OS_IOS::set_user_data_dir(String p_dir) {
- Ref<DirAccess> da = DirAccess::open(p_dir);
- user_data_dir = da->get_current_dir();
- printf("setting data dir to %s from %s\n", user_data_dir.utf8().get_data(), p_dir.utf8().get_data());
-}
-
String OS_IOS::get_user_data_dir() const {
+ static bool user_data_dir_set = false;
+ if (user_data_dir_set) {
+ String old_dir = user_data_dir;
+ Ref<DirAccess> da = DirAccess::open(old_dir);
+ const_cast<OS_IOS *>(this)->user_data_dir = da->get_current_dir();
+ user_data_dir_set = true;
+
+ printf("setting data dir to %s from %s\n", user_data_dir.utf8().get_data(), old_dir.utf8().get_data());
+ }
return user_data_dir;
}