diff options
Diffstat (limited to 'drivers/unix')
| -rw-r--r-- | drivers/unix/SCsub | 10 | ||||
| -rw-r--r-- | drivers/unix/os_unix.cpp | 42 | ||||
| -rw-r--r-- | drivers/unix/os_unix.h | 10 |
3 files changed, 17 insertions, 45 deletions
diff --git a/drivers/unix/SCsub b/drivers/unix/SCsub index c560e1289f..ada8255580 100644 --- a/drivers/unix/SCsub +++ b/drivers/unix/SCsub @@ -2,16 +2,6 @@ Import('env') -g_set_p = '#ifdef UNIX_ENABLED\n' -g_set_p += '#include "os_unix.h"\n' -g_set_p += 'String OS_Unix::get_global_settings_path() const {\n' -g_set_p += '\treturn "' + env["unix_global_settings_path"] + '";\n' -g_set_p += '}\n' -g_set_p += '#endif' -f = open("os_unix_global_settings_path.gen.cpp", "w") -f.write(g_set_p) -f.close() - env.add_source_files(env.drivers_sources, "*.cpp") env["check_c_headers"] = [ [ "mntent.h", "HAVE_MNTENT" ] ] diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index 729abd57ef..0d102902e8 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -133,15 +133,6 @@ void OS_Unix::initialize_core() { } } -void OS_Unix::initialize_logger() { - Vector<Logger *> loggers; - loggers.push_back(memnew(UnixTerminalLogger)); - // FIXME: Reenable once we figure out how to get this properly in user:// - // instead of littering the user's working dirs (res:// + pwd) with log files (GH-12277) - //loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt"))); - _set_logger(memnew(CompositeLogger(loggers))); -} - void OS_Unix::finalize_core() { } @@ -454,32 +445,21 @@ int OS_Unix::get_processor_count() const { return sysconf(_SC_NPROCESSORS_CONF); } -String OS_Unix::get_data_dir() const { - - String an = get_safe_application_name(); - if (an != "") { +String OS_Unix::get_user_data_dir() const { - if (has_environment("HOME")) { - - bool use_godot = ProjectSettings::get_singleton()->get("application/config/use_shared_user_dir"); - if (use_godot) - return get_environment("HOME") + "/.godot/app_userdata/" + an; - else - return get_environment("HOME") + "/." + an; + String appname = get_safe_application_name(); + if (appname != "") { + bool use_godot_dir = ProjectSettings::get_singleton()->get("application/config/use_shared_user_dir"); + if (use_godot_dir) { + return get_data_path().plus_file(get_godot_dir_name()).plus_file("app_userdata").plus_file(appname); + } else { + return get_data_path().plus_file(appname); } } return ProjectSettings::get_singleton()->get_resource_path(); } -String OS_Unix::get_installed_templates_path() const { - String p = get_global_settings_path(); - if (p != "") - return p + "/templates/"; - else - return ""; -} - String OS_Unix::get_executable_path() const { #ifdef __linux__ @@ -554,4 +534,10 @@ void UnixTerminalLogger::log_error(const char *p_function, const char *p_file, i UnixTerminalLogger::~UnixTerminalLogger() {} +OS_Unix::OS_Unix() { + Vector<Logger *> loggers; + loggers.push_back(memnew(UnixTerminalLogger)); + _set_logger(memnew(CompositeLogger(loggers))); +} + #endif diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index 82c7dee3b9..5b3fb824f0 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -53,7 +53,6 @@ protected: virtual int get_audio_driver_count() const; virtual const char *get_audio_driver_name(int p_driver) const; - virtual void initialize_logger(); virtual void initialize_core(); virtual int unix_initialize_audio(int p_audio_driver); //virtual void initialize(int p_video_driver,int p_audio_driver); @@ -62,9 +61,9 @@ protected: String stdin_buf; - String get_global_settings_path() const; - public: + OS_Unix(); + virtual void alert(const String &p_alert, const String &p_title = "ALERT!"); virtual String get_stdin_string(bool p_block); @@ -108,11 +107,8 @@ public: virtual void debug_break(); - virtual String get_installed_templates_path() const; virtual String get_executable_path() const; - virtual String get_data_dir() const; - - //virtual void run( MainLoop * p_main_loop ); + virtual String get_user_data_dir() const; }; class UnixTerminalLogger : public StdLogger { |