]> git.openpandora.org Git - pandora-libraries.git/commitdiff
Some fixes for startdir in .desktop
authorskeezix <skeezix@flotsam-vm.(none)>
Tue, 24 Feb 2009 05:15:52 +0000 (00:15 -0500)
committerskeezix <skeezix@flotsam-vm.(none)>
Tue, 24 Feb 2009 05:15:52 +0000 (00:15 -0500)
include/pnd_apps.h
lib/pnd_discovery.c
testdata/pndsample/x86_echo.pnd
testdata/pndsample/x86_ls.pnd

index ff2bb066d942b6a2792bbc3255eec2039e952771..10f07a49d44fe0edbd06ce484245847e0b9ae90f 100644 (file)
@@ -24,7 +24,7 @@ extern "C" {
 #define PND_DOTDESKTOP_DEFAULT "/usr/share/applications"
 
 // apps
-#define PND_DEFAULT_WORKDIR "/tmp"
+#define PND_DEFAULT_WORKDIR "./"
 
 /* pnd_apps_exec() is used to blindly launch an app, be it a .pnd file bundle or a plain executable
  * (shell, bin, whatever.) pndrun specifies the full path to the pnd_run sh script, which should be
index cb0970333b1f66a2b9eca2e21c3a60dbf41b6fe9..1822c0f52d3f3b677718430949c6fddfc37ddb54 100644 (file)
@@ -290,7 +290,7 @@ unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t
   }
 #endif
 
-#if 0
+#if 0 // we let pnd_run.sh handle this
   if ( p -> startdir ) {
     snprintf ( buffer, 1020, "Path=%s\n", p -> startdir );
     fprintf ( f, "%s", buffer );
@@ -300,11 +300,24 @@ unsigned char pnd_emit_dotdesktop ( char *targetpath, char *pndrun, pnd_disco_t
 #endif
 
   if ( p -> exec ) {
+
+    // basics
     if ( p -> object_type == pnd_object_type_directory ) {
-      snprintf ( buffer, 1020, "Exec=%s -p %s -e %s -u\n", pndrun, p -> object_path, p -> exec );
+      snprintf ( buffer, 1020, "Exec=%s -p %s -e %s -u", pndrun, p -> object_path, p -> exec );
     } else if ( p -> object_type == pnd_object_type_pnd ) {
-      snprintf ( buffer, 1020, "Exec=%s -p %s/%s -e %s -u\n", pndrun, p -> object_path, p -> object_filename, p -> exec );
+      snprintf ( buffer, 1020, "Exec=%s -p %s/%s -e %s -u", pndrun, p -> object_path, p -> object_filename, p -> exec );
+    }
+
+    // start dir
+    if ( p -> startdir ) {
+      strncat ( buffer, " -s ", 1020 );
+      strncat ( buffer, p -> startdir, 1020 );
     }
+
+    // newline
+    strncat ( buffer, "\n", 1020 );
+
+    // emit
     fprintf ( f, "%s", buffer );
   }
 
index 54373736357703f454dd9dd46ca151251a443497..b645c491efad6817c098b748a16a74b3a6d4d741 100644 (file)
Binary files a/testdata/pndsample/x86_echo.pnd and b/testdata/pndsample/x86_echo.pnd differ
index 994b6b0808b12e9e3b812ecfbadc1fb9374eec27..6e308e0fdeebc8ec3f9d1193448d74e2b934c20c 100644 (file)
Binary files a/testdata/pndsample/x86_ls.pnd and b/testdata/pndsample/x86_ls.pnd differ