diff options
Diffstat (limited to 'platform/x11')
-rw-r--r-- | platform/x11/os_x11.cpp | 68 | ||||
-rw-r--r-- | platform/x11/os_x11.h | 2 |
2 files changed, 69 insertions, 1 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 4c45fcfaaf..0466984359 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1088,7 +1088,73 @@ String OS_X11::get_name() { Error OS_X11::shell_open(String p_uri) { - return ERR_UNAVAILABLE; + Error ok; + List<String> args; + args.push_back(p_uri); + ok = execute("/usr/bin/xdg-open",args,false); + if (ok==OK) + return OK; + ok = execute("gnome-open",args,false); + if (ok==OK) + return OK; + ok = execute("kde-open",args,false); + return ok; +} + +String OS_X11::get_system_dir(SystemDir p_dir) const { + + + String xdgparam; + + switch(p_dir) { + case SYSTEM_DIR_DESKTOP: { + + xdgparam="DESKTOP"; + } break; + case SYSTEM_DIR_DCIM: { + + xdgparam="PICTURES"; + + } break; + case SYSTEM_DIR_DOCUMENTS: { + + xdgparam="DOCUMENTS"; + + } break; + case SYSTEM_DIR_DOWNLOADS: { + + xdgparam="DOWNLOAD"; + + } break; + case SYSTEM_DIR_MOVIES: { + + xdgparam="VIDEOS"; + + } break; + case SYSTEM_DIR_MUSIC: { + + xdgparam="MUSIC"; + + } break; + case SYSTEM_DIR_PICTURES: { + + xdgparam="PICTURES"; + + } break; + case SYSTEM_DIR_RINGTONES: { + + xdgparam="MUSIC"; + + } break; + } + + String pipe; + List<String> arg; + arg.push_back(xdgparam); + Error err = const_cast<OS_X11*>(this)->execute("/usr/bin/xdg-user-dir",arg,true,NULL,&pipe); + if (err!=OK) + return "."; + return pipe.strip_edges(); } diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 2ffca0e042..67772894fa 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -197,6 +197,8 @@ public: virtual void make_rendering_thread(); virtual void swap_buffers(); + virtual String get_system_dir(SystemDir p_dir) const; + virtual Error shell_open(String p_uri); virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0); |