summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLouie S <louie@example.com>2023-02-23 20:02:35 -0800
committerLouie S <louie@example.com>2023-02-23 20:02:35 -0800
commit01d60765f8441e5d81e7c02770731af8c0676c21 (patch)
treee1a3bfefe7c00d83b474f20a283547bf7a2de636 /src
parentd6709baba9c8d1c082116dccdd5e75c2c58288fc (diff)
Fix first boot crash on unix
Diffstat (limited to 'src')
-rw-r--r--src/include/read_cfg.h2
-rw-r--r--src/unix/read_cfg.c7
2 files changed, 4 insertions, 5 deletions
diff --git a/src/include/read_cfg.h b/src/include/read_cfg.h
index b6b996f..df3e5bd 100644
--- a/src/include/read_cfg.h
+++ b/src/include/read_cfg.h
@@ -17,7 +17,7 @@ void error_mes(int ln, char *message);
//functions that differ by os
extern char sep;
char *find_config();
-void mkconfig_wizard();
+void mkconfig_wizard(char *path);
void handle_fname(char *path, char *group, bool recurs, bool force, char *name, int ln);
#endif
diff --git a/src/unix/read_cfg.c b/src/unix/read_cfg.c
index 4d98c82..b40dd48 100644
--- a/src/unix/read_cfg.c
+++ b/src/unix/read_cfg.c
@@ -24,7 +24,7 @@ char *find_config(){
sprintf(choices[1], "%s%c.terminal-media-launcher%cconfig", home, sep, sep);
for(i = 0; i < check_count; i++){
- path = choices[i];
+ strcpy(path, choices[i]);
printf("Checking for config at %s: ", choices[i]);
if(access(path, R_OK) == 0){
printf("Using config \"%s\"\n\n", path);
@@ -33,9 +33,8 @@ char *find_config(){
else printf("File does not exist\n");
}
- //TODO no config exists, ask user if they want to autogenerate one
mkconfig_wizard(choices[0]);
- path = choices[0];
+ strcpy(path, choices[0]);
return path;
}
@@ -185,7 +184,7 @@ void handle_fname(char *path, char *group, bool recurs, bool force, char *name,
//the directory is real
if(dp != NULL){
- while(fname = readdir(dp)){
+ while((fname = readdir(dp))){
relative_path_cpy[0] = '\0';
strcat(relative_path_cpy, dirname);
strcat(relative_path_cpy, fname->d_name);