summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 90e829e..95eef75 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2,9 +2,17 @@
#include <lauxlib.h>
#include <lualib.h>
#include "options/options.h"
+#include "logging/logging.h"
#include "util/util.h"
#include "common.h"
+#ifdef _WIN32
+# include <direct.h>
+# define chdir _chdir
+#else
+# include <unistd.h>
+#endif
+
void print_load_error(lua_State *L, const char *script_file, int error_type);
void setup_version(lua_State *L, int honey_tbl);
@@ -16,6 +24,12 @@ int main(int argc, char **argv)
int result = parse_options(&options, argc, argv);
if (result == EXIT_FAILURE) return 1;
else if (result == EXIT_SUCCESS) return 0;
+ honey_set_log_level(options.log_level);
+
+ /* configure working directory */
+ if (options.working_dir != NULL) {
+ chdir(options.working_dir);
+ }
/* set up lua state */
lua_State *L = luaL_newstate();