aboutsummaryrefslogtreecommitdiff
path: root/src/parser.cpp
diff options
context:
space:
mode:
authorJeroen van Rijn <Kelimion@users.noreply.github.com>2024-07-22 16:22:17 +0200
committerGitHub <noreply@github.com>2024-07-22 16:22:17 +0200
commit4889641af4fabcc4f02b5329942256f0313037a6 (patch)
treeb8cb0b4ebffb08eb71c0ae11bcc6c361ce0e7706 /src/parser.cpp
parenta39b6de18ce2c3367371f9eb87e813d68fa7a732 (diff)
parent90a4d12b30f24c4a44a8c8e606ce56efde56cf50 (diff)
Merge pull request #3959 from Kelimion/fix-output-is-directory-check
Fix .exe path is directory check.
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index f2d2a1d15..eaf43b5bc 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -6543,10 +6543,9 @@ gb_internal ParseFileError parse_packages(Parser *p, String init_filename) {
}
if ((build_context.command_kind & Command__does_build) &&
build_context.build_mode == BuildMode_Executable) {
- String short_path = filename_from_path(path);
-
- char *cpath = alloc_cstring(temporary_allocator(), short_path);
- if (gb_file_exists(cpath)) {
+ String output_path = path_to_string(temporary_allocator(), build_context.build_paths[8]);
+ char *cpath = alloc_cstring(temporary_allocator(), output_path);
+ if (path_is_directory(output_path) && gb_file_exists(cpath)) {
error({}, "Please specify the executable name with -out:<string> as a directory exists with the same name in the current working directory");
return ParseFile_DirectoryAlreadyExists;
}