CC=/usr/bin/gcc
CF=-g -Wall
-all: runcwd runcwdi test
+all: runcwd runcwdi
+
runcwd: runcwd.c
$(CC) $(CF) -o 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
--- /dev/null
+[Desktop Entry]
+Type=Application
+Name=execwd
+Exec=/usr/bin/runcwdi %f %f
+Categories=Other;System
+NoDisplay=true
+MimeType=application/x-sharedlib
+Terminal=true
--- /dev/null
+[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
--- /dev/null
+[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
-//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>
fprintf(stderr,"%s\n","CWD missing.");
return 1;
}
- else if (argc <3) {
+ else if (argc<3) {
fprintf(stderr,"%s\n","Command missing.");
return 1;
}
-//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>
fprintf(stderr,"%s\n","CWD missing.");
return 1;
}
- else if (argc <3) {
+ else if (argc<3) {
fprintf(stderr,"%s\n","Command missing.");
return 1;
}