Skip to content

Commit

Permalink
use comptime constant for default script path
Browse files Browse the repository at this point in the history
  • Loading branch information
jmattaa committed Nov 24, 2024
1 parent 1bf3f91 commit 4b59e2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include")

add_executable(lsr ${SRCS})

target_compile_definitions(lsr PRIVATE DEFAULT_SCRIPT_PATH="${CMAKE_INSTALL_PREFIX}/share/lsr/lsr.lua")
target_include_directories(lsr PRIVATE ${LUA_INCLUDE_DIR})
target_link_libraries(lsr PRIVATE ${LUA_LIBRARIES})

Expand Down
7 changes: 6 additions & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@
#include <string.h>
#include <unistd.h>


#ifndef DEFAULT_SCRIPT_PATH
#define DEFAULT_SCRIPT_PATH "/usr/local/share/lsr/lsr.lua"
#endif

lua_State *L;

lua_State *initialize_lua(void)
Expand Down Expand Up @@ -59,7 +64,7 @@ int main(int argc, char **argv)
if (!initialize_lua())
return 1;

const char *default_script = "/usr/local/share/lsr/lsr.lua";
const char *default_script = DEFAULT_SCRIPT_PATH;

const char *user_script = getenv("HOME");
char user_config_path[LASER_PATH_MAX];
Expand Down

0 comments on commit 4b59e2b

Please sign in to comment.