From d894ebf8ebdbd1b9e1d92b3278697db5971b7de6 Mon Sep 17 00:00:00 2001 From: skeezix Date: Tue, 24 Feb 2009 00:15:52 -0500 Subject: [PATCH] Some fixes for startdir in .desktop --- include/pnd_apps.h | 2 +- lib/pnd_discovery.c | 19 ++++++++++++++++--- testdata/pndsample/x86_echo.pnd | Bin 387551 -> 387551 bytes testdata/pndsample/x86_ls.pnd | Bin 489775 -> 489775 bytes 4 files changed, 17 insertions(+), 4 deletions(-) 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 54373736357703f454dd9dd46ca151251a443497..b645c491efad6817c098b748a16a74b3a6d4d741 100644 GIT binary patch delta 104 zcmcbAS^WNG@eL-;5+())29`!Z;ti0nG%zxP3QYECmS%^tH|I6$nX*VQaEeS`u)|6S g#CVg-ghVyJ+0p)H2O|(O0WmWWvuuB}gY~lk0GNCuiU0rr delta 104 zcmcbAS^WNG@eL-;62?Zxrly7#1_p183=Av{jEtZHlYN?{*`e&sdChvJEaKwkLX#Kl juo40>-sCbNQO$35w7=QG2*gZ4%nZaV+u!V9{cHdL%7P@e diff --git a/testdata/pndsample/x86_ls.pnd b/testdata/pndsample/x86_ls.pnd index 994b6b0808b12e9e3b812ecfbadc1fb9374eec27..6e308e0fdeebc8ec3f9d1193448d74e2b934c20c 100644 GIT binary patch delta 108 zcmZ4gNp}4w*$pPm5+())29`!Z;ti0nG%zxP3QYECmS%^tH|I6$nX*VQaEeS`u)|6S j#CVg-ghVyJ+0p)H2O|(O0WmWWvj8#c_BT7&oDTp1A<`v< delta 108 zcmZ4gNp}4w*$pPm62?Zxrly7#1_p183=Av{jEtZHlYN?{*`e&sdChvJEaKwkLX#Kl luo40>-sCbNQO$35w7=QG2*gZ4%nZaVK+L-R%?>u_0{~cvCb0kj -- 2.39.2