diff --git a/CMakeLists.txt b/CMakeLists.txt index fc6b2b0..635306b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/src/main.c b/src/main.c index d988f3d..1133920 100644 --- a/src/main.c +++ b/src/main.c @@ -10,6 +10,11 @@ #include #include + +#ifndef DEFAULT_SCRIPT_PATH +#define DEFAULT_SCRIPT_PATH "/usr/local/share/lsr/lsr.lua" +#endif + lua_State *L; lua_State *initialize_lua(void) @@ -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];