From 09f94ae7c41a6ddf30dc325b1e5e6d7383c72f78 Mon Sep 17 00:00:00 2001 From: b Date: Thu, 13 Jul 2023 00:05:18 +0200 Subject: [PATCH] improve install and desktop entry --- makefile | 19 ++++++++++++++++--- runcwd-exe.desktop | 8 ++++++++ runcwd-jar.desktop | 8 ++++++++ runcwd-wine.desktop | 8 ++++++++ runcwd.c | 11 ++++++++--- runcwdi.c | 11 ++++++++--- 6 files changed, 56 insertions(+), 9 deletions(-) create mode 100644 runcwd-exe.desktop create mode 100644 runcwd-jar.desktop create mode 100644 runcwd-wine.desktop diff --git a/makefile b/makefile index f2433c6..9cee506 100644 --- a/makefile +++ b/makefile @@ -1,7 +1,8 @@ CC=/usr/bin/gcc CF=-g -Wall -all: runcwd runcwdi test +all: runcwd runcwdi + runcwd: runcwd.c $(CC) $(CF) -o runcwd runcwd.c @@ -9,5 +10,17 @@ runcwd: runcwd.c runcwdi: runcwdi.c $(CC) $(CF) -o runcwdi runcwdi.c -test: test.c - $(CC) $(CF) -o test test.c + +install: cp_bin cp_dt + + +cp_bin: runcwd runcwdi + cp runcwd runcwdi /usr/bin/ + +cp_dt: runcwd-exe.desktop runcwd-jar.desktop runcwd-wine.desktop + cp runcwd-exe.desktop runcwd-jar.desktop runcwd-wine.desktop /usr/share/applications + +clean: + rm -f runcwd runcwdi + +PHONY: all cp_bin cp_dt install clean \ No newline at end of file diff --git a/runcwd-exe.desktop b/runcwd-exe.desktop new file mode 100644 index 0000000..3459359 --- /dev/null +++ b/runcwd-exe.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=execwd +Exec=/usr/bin/runcwdi %f %f +Categories=Other;System +NoDisplay=true +MimeType=application/x-sharedlib +Terminal=true diff --git a/runcwd-jar.desktop b/runcwd-jar.desktop new file mode 100644 index 0000000..d66e318 --- /dev/null +++ b/runcwd-jar.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=java jar +Exec=/usr/bin/runcwdi %f /usr/bin/java -jar %f +Categories=Other;System; +NoDisplay=true +MimeType=application/x-java-archive +Terminal=false diff --git a/runcwd-wine.desktop b/runcwd-wine.desktop new file mode 100644 index 0000000..ef94d10 --- /dev/null +++ b/runcwd-wine.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=winecwd +Exec=/usr/bin/runcwdi %f /usr/bin/wine %f +Categories=Other;System; +NoDisplay=true +MimeType=application/x-ms-dos-executable +Terminal=false diff --git a/runcwd.c b/runcwd.c index 118f6a5..ccc11b7 100644 --- a/runcwd.c +++ b/runcwd.c @@ -1,5 +1,10 @@ -//Niezła wymota -//This generic wrapper allows to run a program with specified CWD. First argument is the CWD, second is the program to run, rest are the parameters passed to that program +/* +This generic wrapper allows to run a program with specified CWD. +First argument is the CWD +(must end with "/", anything after it is ignored), +second is the program to run, +rest are the parameters passed to that program +*/ #include #include @@ -12,7 +17,7 @@ int main(int argc, char *argv[], char *envp[]) fprintf(stderr,"%s\n","CWD missing."); return 1; } - else if (argc <3) { + else if (argc<3) { fprintf(stderr,"%s\n","Command missing."); return 1; } diff --git a/runcwdi.c b/runcwdi.c index 3f304b2..13c4cce 100644 --- a/runcwdi.c +++ b/runcwdi.c @@ -1,5 +1,10 @@ -//Niezła wymota -//This generic wrapper allows to run a program with specified CWD. First argument is the CWD (must end with "/", anything after it is ignored), second is the program to run, rest are the parameters passed to that program +/* +This generic wrapper allows to run a program with specified CWD. +First argument is the CWD +(must end with "/", anything after it is ignored), +second is the program to run, +rest are the parameters passed to that program +*/ #include #include @@ -13,7 +18,7 @@ int main(int argc, char *argv[], char *envp[]) fprintf(stderr,"%s\n","CWD missing."); return 1; } - else if (argc <3) { + else if (argc<3) { fprintf(stderr,"%s\n","Command missing."); return 1; } -- 2.30.2