[Wine-patches] winemenubuilder: use xdg-user-dir for find desktop directory (eterbug #3640)

Konstantin Kondratyuk =?iso-8859-1?q?kondratyuk_=CE=C1_etersoft=2Eru?=
Пт Мар 13 18:53:51 MSK 2009


Возможно, работает :)

-- 
Best regards,
Konstantin Kondratyuk.
----------- следующая часть -----------
From b8527ff4ae5a569be65873404d373d75edb7972e Mon Sep 17 00:00:00 2001
From: Konstantin Kondratyuk <kondratyuk на etersoft.ru>
Date: Fri, 13 Mar 2009 18:51:37 +0300
Subject: [PATCH] winemenubuilder: use xdg-user-dir for find desktop directory (eterbug #3640)

---
 programs/winemenubuilder/winemenubuilder.c |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index f5f7ec0..7932150 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -1375,6 +1375,8 @@ static BOOL InvokeShellLinker( IShellLinkW *sl, LPCWSTR link, BOOL bWait )
 
     if (in_desktop_dir(csidl))
     {
+        FILE *ptr;
+        char *desktop = NULL;
         char *location;
         const char *lastEntry;
         lastEntry = strrchr(link_name, '/');
@@ -1382,7 +1384,22 @@ static BOOL InvokeShellLinker( IShellLinkW *sl, LPCWSTR link, BOOL bWait )
             lastEntry = link_name;
         else
             ++lastEntry;
-        location = heap_printf("%s/Desktop/%s.desktop", getenv("HOME"), lastEntry);
+
+        if((ptr = popen("xdg-user-dir DESKTOP","r")))
+        {
+            char buf[256];
+            fgets(buf, sizeof(buf), ptr);
+            pclose(ptr);
+            if(buf[0] == '/')
+                desktop = heap_printf("%s", buf);
+        }
+        if(!desktop)
+            desktop = heap_printf("%s/Desktop",getenv("HOME"));
+
+        location = heap_printf("%s/%s.desktop", desktop, lastEntry);
+
+        WINE_TRACE("Desktop directory is: %s\n",location);
+
         if (location)
         {
             r = !write_desktop_entry(location, lastEntry, escaped_path, escaped_args, escaped_description, work_dir, icon_name);
-- 
1.6.1.3.GIT



Подробная информация о списке рассылки Wine-patches