diff --git a/releasenotes.md b/releasenotes.md index 4c83cd147..608087ae0 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -84,6 +84,7 @@ - Fix aligned alloc for Win32 targets. - Compiler didn't detect when a module name was used both as a generic and regular module. - Assigning a const zero to an aliased distinct caused an error. +- `--path` is now properly respected. ### Stdlib changes diff --git a/src/compiler/compiler.c b/src/compiler/compiler.c index 446c329c0..b1a6615d5 100644 --- a/src/compiler/compiler.c +++ b/src/compiler/compiler.c @@ -32,6 +32,12 @@ const char* c3_suffix_list[3] = { ".c3", ".c3t", ".c3i" }; void compiler_init(BuildOptions *build_options) { + // Process --path + if (build_options->path && !dir_change(build_options->path)) + { + error_exit("Failed to change path to '%s'.", build_options->path); + } + compiler_init_time = -1; compiler_parsing_time = -1; compiler_sema_time = -1; diff --git a/src/utils/file_utils.c b/src/utils/file_utils.c index eeae7a4ef..b3f9b1075 100644 --- a/src/utils/file_utils.c +++ b/src/utils/file_utils.c @@ -373,13 +373,10 @@ const char *find_rel_exe_dir(const char *dir) return scratch_buffer_to_string(); } return NULL; - - } const char *find_lib_dir(void) { - char *path = find_executable_path(); INFO_LOG("Detected executable path at %s", path);