summaryrefslogtreecommitdiff
path: root/windows/draw.c
diff options
context:
space:
mode:
authorlouie <lshprung@yahoo.com>2020-12-28 12:47:47 -0800
committerlouie <lshprung@yahoo.com>2020-12-28 12:47:47 -0800
commitd7fa91b54c7dcce8dedbe32f37cf849f530f8864 (patch)
treec22df16697dc92aaed450412e11697eb13a62858 /windows/draw.c
parentcf54938e343a9fced866fd2f2602eb807b7b8a93 (diff)
Cleaned up ifdefs
Diffstat (limited to 'windows/draw.c')
-rw-r--r--windows/draw.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/windows/draw.c b/windows/draw.c
new file mode 100644
index 0000000..5a69b09
--- /dev/null
+++ b/windows/draw.c
@@ -0,0 +1,43 @@
+#include <stdbool.h>
+#include <windows.h>
+
+#include "../draw.h"
+#include "../entry.h"
+#include "../group.h"
+
+void launch(){
+ char *program = get_gprog(g[g_hover]);
+ char *flags = get_gflags(g[g_hover]);
+ char *path = get_epath(e[e_hover]);
+ bool quotes = get_gquotes(g[g_hover]);
+ char file[BUF_LEN];
+ char params[BUF_LEN];
+
+ file[0] = '\0';
+
+ if(!(strcmp(program, "./"))){
+ strcat(file, "\"");
+ strcat(file, path);
+ strcat(file, "\"");
+ ShellExecute(NULL, NULL, file, NULL, NULL, SW_SHOW);
+ }
+
+ else{
+ if(quotes) strcat(file, "\"");
+ strcat(file, program);
+ if(quotes) strcat(file, "\"");
+
+ params[0] = '\0';
+ if(flags[0] != '\0'){
+ strcat(params, flags);
+ strcat(params, " ");
+ }
+ strcat(params, "\"");
+ strcat(params, path);
+ strcat(params, "\"");
+
+ ShellExecute(NULL, NULL, file, params, NULL, SW_SHOW);
+ }
+
+ return;
+}