summaryrefslogtreecommitdiff
path: root/platform/x11
diff options
context:
space:
mode:
authorAnton Yabchinskiy <arn@bestmx.ru>2014-12-03 14:49:56 +0300
committerAnton Yabchinskiy <arn@devline.ru>2014-12-04 16:32:43 +0300
commit99676d7e742ebb31b920eb37d7a955b235be35ed (patch)
treee4474598eb2b6b771a25897e0b3170059ad0ed7c /platform/x11
parentfff056bdc5b030e39ecfa619c8f58b20305ebeae (diff)
parent8ad12525a90d90d77dc08b3d6decae33be5675c4 (diff)
Merge branch 'master' of https://github.com/okamstudio/godot
Diffstat (limited to 'platform/x11')
-rw-r--r--platform/x11/os_x11.cpp68
-rw-r--r--platform/x11/os_x11.h2
2 files changed, 69 insertions, 1 deletions
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 278950ba3a..331e25a363 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -1089,7 +1089,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 815896bc37..6d1f54cb36 100644
--- a/platform/x11/os_x11.h
+++ b/platform/x11/os_x11.h
@@ -202,6 +202,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);