From: skeezix Date: Tue, 24 Feb 2009 05:15:52 +0000 (-0500) Subject: Some fixes for startdir in .desktop X-Git-Tag: Release-2010-05/1~203 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d894ebf8ebdbd1b9e1d92b3278697db5971b7de6;p=pandora-libraries.git Some fixes for startdir in .desktop --- diff --git a/include/pnd_apps.h b/include/pnd_apps.h index ff2bb06..10f07a4 100644 --- a/include/pnd_apps.h +++ b/include/pnd_apps.h @@ -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 diff --git a/lib/pnd_discovery.c b/lib/pnd_discovery.c index cb09703..1822c0f 100644 --- a/lib/pnd_discovery.c +++ b/lib/pnd_discovery.c @@ -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 ); } diff --git a/testdata/pndsample/x86_echo.pnd b/testdata/pndsample/x86_echo.pnd index 5437373..b645c49 100644 Binary files a/testdata/pndsample/x86_echo.pnd and b/testdata/pndsample/x86_echo.pnd differ diff --git a/testdata/pndsample/x86_ls.pnd b/testdata/pndsample/x86_ls.pnd index 994b6b0..6e308e0 100644 Binary files a/testdata/pndsample/x86_ls.pnd and b/testdata/pndsample/x86_ls.pnd differ