Main: Create user data dir in setup()
Custom backport of #39563 with preliminary change to make
`OS::ensure_user_data_dir()` public as done in f8a79a9
.
Fixes #32488.
This commit is contained in:
parent
292bbb870f
commit
d6fecf7686
8 changed files with 6 additions and 12 deletions
|
@ -460,8 +460,7 @@ OS::ScreenOrientation OS::get_screen_orientation() const {
|
|||
return (OS::ScreenOrientation)_orientation;
|
||||
}
|
||||
|
||||
void OS::_ensure_user_data_dir() {
|
||||
|
||||
void OS::ensure_user_data_dir() {
|
||||
String dd = get_user_data_dir();
|
||||
DirAccess *da = DirAccess::open(dd);
|
||||
if (da) {
|
||||
|
|
|
@ -140,7 +140,6 @@ protected:
|
|||
|
||||
virtual void set_cmdline(const char *p_execpath, const List<String> &p_args);
|
||||
|
||||
void _ensure_user_data_dir();
|
||||
virtual bool _check_internal_feature_support(const String &p_feature) = 0;
|
||||
|
||||
public:
|
||||
|
@ -305,6 +304,8 @@ public:
|
|||
virtual List<String> get_cmdline_args() const { return _cmdline; }
|
||||
virtual String get_model_name() const;
|
||||
|
||||
void ensure_user_data_dir();
|
||||
|
||||
virtual MainLoop *get_main_loop() const = 0;
|
||||
|
||||
virtual void yield();
|
||||
|
|
|
@ -899,6 +899,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
|
|||
#endif
|
||||
}
|
||||
|
||||
// Initialize user data dir.
|
||||
OS::get_singleton()->ensure_user_data_dir();
|
||||
|
||||
GLOBAL_DEF("memory/limits/multithreaded_server/rid_pool_prealloc", 60);
|
||||
ProjectSettings::get_singleton()->set_custom_property_info("memory/limits/multithreaded_server/rid_pool_prealloc", PropertyInfo(Variant::INT, "memory/limits/multithreaded_server/rid_pool_prealloc", PROPERTY_HINT_RANGE, "0,500,1")); // No negative and limit to 500 due to crashes
|
||||
GLOBAL_DEF("network/limits/debugger_stdout/max_chars_per_second", 2048);
|
||||
|
|
|
@ -1774,8 +1774,6 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
|||
|
||||
power_manager = memnew(PowerOSX);
|
||||
|
||||
_ensure_user_data_dir();
|
||||
|
||||
restore_rect = Rect2(get_window_position(), get_window_size());
|
||||
|
||||
if (p_desired.layered) {
|
||||
|
|
|
@ -97,8 +97,6 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int
|
|||
power_manager = memnew(PowerX11);
|
||||
#endif
|
||||
|
||||
_ensure_user_data_dir();
|
||||
|
||||
resource_loader_dummy.instance();
|
||||
ResourceLoader::add_resource_format_loader(resource_loader_dummy);
|
||||
|
||||
|
|
|
@ -340,8 +340,6 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
|||
ref new TypedEventHandler<Gyrometer ^, GyrometerReadingChangedEventArgs ^>(managed_object, &ManagedType::on_gyroscope_reading_changed);
|
||||
}
|
||||
|
||||
_ensure_user_data_dir();
|
||||
|
||||
if (is_keep_screen_on())
|
||||
display_request->RequestActive();
|
||||
|
||||
|
|
|
@ -1687,8 +1687,6 @@ Error OS_Windows::initialize(const VideoMode &p_desired, int p_video_driver, int
|
|||
|
||||
RegisterTouchWindow(hWnd, 0);
|
||||
|
||||
_ensure_user_data_dir();
|
||||
|
||||
DragAcceptFiles(hWnd, true);
|
||||
|
||||
move_timer_id = 1;
|
||||
|
|
|
@ -605,7 +605,6 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
|
|||
#ifdef JOYDEV_ENABLED
|
||||
joypad = memnew(JoypadLinux(input));
|
||||
#endif
|
||||
_ensure_user_data_dir();
|
||||
|
||||
power_manager = memnew(PowerX11);
|
||||
|
||||
|
|
Loading…
Reference in a new issue