]> bicyclesonthemoon.info Git - botm/runcwd/commitdiff
improve install and desktop entry main
authorb <rowerynaksiezycu@gmail.com>
Wed, 12 Jul 2023 22:05:18 +0000 (00:05 +0200)
committerb <rowerynaksiezycu@gmail.com>
Wed, 12 Jul 2023 22:05:18 +0000 (00:05 +0200)
makefile
runcwd-exe.desktop [new file with mode: 0644]
runcwd-jar.desktop [new file with mode: 0644]
runcwd-wine.desktop [new file with mode: 0644]
runcwd.c
runcwdi.c

index f2433c62f1d0cfbcfbf18b1f20f9d8ff92faa291..9cee50649ae7fb1ada31f29266b653dd01df5033 100644 (file)
--- 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 (file)
index 0000000..3459359
--- /dev/null
@@ -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 (file)
index 0000000..d66e318
--- /dev/null
@@ -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 (file)
index 0000000..ef94d10
--- /dev/null
@@ -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
index 118f6a56375620a199938410fa26d96dccd815d1..ccc11b75a01704da1ebabd9a2e86ca7fbd832bab 100644 (file)
--- 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 <unistd.h>
 #include <stdio.h>
@@ -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;
        }
index 3f304b21a70d6a52bcdfb302e7ee53f96b4f2130..13c4cce7b8ff03754658867e6b6ee9ee557c9515 100644 (file)
--- 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 <string.h>
 #include <unistd.h>
@@ -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;
        }