aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Lance Borden 2025-08-19 15:03:34 -0400
committerGravatar Lance Borden 2025-08-19 15:03:34 -0400
commit5293253c628c54c9096f3d07191a5934a6d979aa (patch)
tree6a915821aa2bb0653c3e06f8f1b69c4fff5fe308 /src
parentupdate compil instructions (diff)
keep history to home dir and use .config instead of custom dotfile dir
Diffstat (limited to 'src')
-rw-r--r--src/history.c4
-rw-r--r--src/lua_api.c8
2 files changed, 8 insertions, 4 deletions
diff --git a/src/history.c b/src/history.c
index 93d6983..760461e 100644
--- a/src/history.c
+++ b/src/history.c
@@ -34,7 +34,7 @@ static char *get_history_path() {
return NULL;
}
- size_t path_length = strlen(pw->pw_dir) + strlen("/.lush/.history") + 1;
+ size_t path_length = strlen(pw->pw_dir) + strlen("/.lush_history") + 1;
char *path = malloc(path_length);
if (!path) {
perror("malloc");
@@ -42,7 +42,7 @@ static char *get_history_path() {
}
strcpy(path, pw->pw_dir);
- strcat(path, "/.lush/.history");
+ strcat(path, "/.lush_history");
return path;
}
diff --git a/src/lua_api.c b/src/lua_api.c
index a35a308..0e20752 100644
--- a/src/lua_api.c
+++ b/src/lua_api.c
@@ -95,9 +95,13 @@ void lua_run_init(lua_State *L) {
char script_path[64];
const char *home_dir = getenv("HOME");
if (home_dir != NULL) {
- snprintf(script_path, sizeof(script_path), "%s/.lush/init.lua",
+ snprintf(script_path, sizeof(script_path), "%s/.config/lush/init.lua",
home_dir);
- lua_load_script(L, script_path, NULL);
+ FILE *f = fopen(script_path, "r");
+ if (f != NULL) {
+ fclose(f);
+ lua_load_script(L, script_path, NULL);
+ }
}
}