mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builder: add a verror, when the output folder is not existing and writable (#5966)
This commit is contained in:
@ -27,6 +27,18 @@ fn get_vtmp_filename(base_file_name, postfix string) string {
|
||||
}
|
||||
|
||||
pub fn compile(command string, pref &pref.Preferences) {
|
||||
odir := os.base_dir(pref.out_name)
|
||||
// When pref.out_name is just the name of an executable, i.e. `./v -o executable main.v`
|
||||
// without a folder component, just use the current folder instead:
|
||||
mut output_folder := odir
|
||||
if odir.len == pref.out_name.len {
|
||||
output_folder = os.getwd()
|
||||
}
|
||||
os.is_writable_folder(output_folder) or {
|
||||
// An early error here, is better than an unclear C error later:
|
||||
verror(err)
|
||||
exit(1)
|
||||
}
|
||||
// Construct the V object from command line arguments
|
||||
mut b := new_builder(pref)
|
||||
if pref.is_verbose {
|
||||
|
Reference in New Issue
Block a user