diff --git a/releasenotes.md b/releasenotes.md index 110385f16..749fd46a6 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -7,6 +7,7 @@ ### Stdlib changes ### Fixes +- Add error message if directory with output file name already exists ## 0.7.9 Change list diff --git a/src/compiler/linker.c b/src/compiler/linker.c index cc5779b9b..32dc1eada 100644 --- a/src/compiler/linker.c +++ b/src/compiler/linker.c @@ -1051,6 +1051,11 @@ void platform_linker(const char *output_file, const char **files, unsigned file_ vec_add(parts, compiler.build.cc ? compiler.build.cc : default_c_compiler()); } + if (file_is_dir(output_file)) + { + error_exit("Failed to link executable '%s', a directory with that name already exists.", output_file); + } + linker_setup(&parts, files, file_count, output_file, linker_type, &compiler.linking); const char *output = assemble_linker_command(parts, PLATFORM_WINDOWS); if (compiler.build.print_linking) puts(output);