about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/misc/gmrun/gmrun-0.9.2-xdg.patch
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/applications/misc/gmrun/gmrun-0.9.2-xdg.patch')
-rw-r--r--nixpkgs/pkgs/applications/misc/gmrun/gmrun-0.9.2-xdg.patch58
1 files changed, 58 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/misc/gmrun/gmrun-0.9.2-xdg.patch b/nixpkgs/pkgs/applications/misc/gmrun/gmrun-0.9.2-xdg.patch
new file mode 100644
index 000000000000..b5cd41a3c5b4
--- /dev/null
+++ b/nixpkgs/pkgs/applications/misc/gmrun/gmrun-0.9.2-xdg.patch
@@ -0,0 +1,58 @@
+diff -ur a/src/history.cc src/history.cc
+--- a/src/history.cc	2002-08-17 15:19:31.000000000 +0200
++++ a/src/history.cc	2012-06-04 23:42:35.314653414 +0200
+@@ -24,8 +24,15 @@
+ HistoryFile::HistoryFile()
+ {
+   m_file_entries = 0;
+-  m_filename = g_get_home_dir();
+-  m_filename += "/.gmrun_history";
++  const char* filename = getenv("XDG_CACHE_HOME");
++  if (filename != 0 && *filename != '\0') {
++    m_filename = filename;
++    m_filename += "/gmrun_history";
++  }
++  else {
++    m_filename = g_get_home_dir();
++    m_filename += "/.gmrun_history";
++  }
+   m_current = 0;
+   m_default_set = false;
+   read_the_file();
+diff -ur a/src/prefs.cc src/prefs.cc
+--- a/src/prefs.cc	2012-06-04 22:35:00.671949439 +0200
++++ a/src/prefs.cc	2012-06-04 23:24:24.184445962 +0200
+@@ -35,12 +35,29 @@
+   file_name += GMRUNRC;
+   init(file_name);
+ 
+-  file_name = getenv("HOME");
+-  if (!file_name.empty()) {
++  file_name.clear();
++  const char* filename = getenv("XDG_CONFIG_HOME");
++  if (filename != 0 && *filename != '\0') {
++    file_name = filename;
+     string::iterator i = file_name.end() - 1;
+-    if (*i == '/') file_name.erase(i);
+-    file_name += "/.";
++    if (*i != '/') {
++      file_name += '/';
++    }
+     file_name += GMRUNRC;
++  }
++  else {
++    filename = getenv("HOME");
++    if (filename != 0 && *filename != '\0') {
++      file_name = filename;
++      string::iterator i = file_name.end() - 1;
++      if (*i != '/') {
++        file_name += '/';
++      }
++      file_name += '.';
++      file_name += GMRUNRC;
++    }
++  }
++  if (!file_name.empty()) {
+     init(file_name);
+   }
+ }