mirror of
https://github.com/odin-lang/Odin.git
synced 2025-12-29 09:24:33 +00:00
Compiler: Add early error for output path being a directory.
- Introduce new `Path` type and an array of build paths on the build context. - Resolve input and output paths/files early (before parsing). - Error early if inputs are missing or outputs are directories. - Plumb new file path generation into linker stage instead of its adhoc method. TODO: - Remove more adhoc file path generation in parser and linker stage. - Make intermediate object file generation use new path system. - Round out and robustify Path helper functions.
This commit is contained in:
@@ -245,15 +245,14 @@ gb_inline isize string_extension_position(String const &str) {
|
||||
return dot_pos;
|
||||
}
|
||||
|
||||
String path_extension(String const &str) {
|
||||
String path_extension(String const &str, bool include_dot = true) {
|
||||
isize pos = string_extension_position(str);
|
||||
if (pos < 0) {
|
||||
return make_string(nullptr, 0);
|
||||
}
|
||||
return substring(str, pos, str.len);
|
||||
return substring(str, include_dot ? pos : pos + 1, str.len);
|
||||
}
|
||||
|
||||
|
||||
String string_trim_whitespace(String str) {
|
||||
while (str.len > 0 && rune_is_whitespace(str[str.len-1])) {
|
||||
str.len--;
|
||||
@@ -328,7 +327,10 @@ String directory_from_path(String const &s) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return substring(s, 0, i);
|
||||
if (i >= 0) {
|
||||
return substring(s, 0, i);
|
||||
}
|
||||
return substring(s, 0, 0);
|
||||
}
|
||||
|
||||
String concatenate_strings(gbAllocator a, String const &x, String const &y) {
|
||||
|
||||
Reference in New Issue
Block a user