fix running `v run file.v` in a current working folder containing a run/ subfolder

pull/10999/head
Delyan Angelov 2021-07-30 03:24:36 +03:00
parent 44892fd942
commit 7d5b6d2b48
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
1 changed files with 3 additions and 3 deletions

View File

@ -620,9 +620,7 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences
eprintln('Cannot save output binary in a .v file.') eprintln('Cannot save output binary in a .v file.')
exit(1) exit(1)
} }
if is_source_file(command) { if command == 'run' {
res.path = command
} else if command == 'run' {
res.is_run = true res.is_run = true
if command_pos + 2 > args.len { if command_pos + 2 > args.len {
eprintln('v run: no v files listed') eprintln('v run: no v files listed')
@ -666,6 +664,8 @@ pub fn parse_args(known_external_commands []string, args []string) (&Preferences
eprintln('It looks like you wanted to run "${res.path}.v", so we went ahead and did that since "$res.path" is an executable.') eprintln('It looks like you wanted to run "${res.path}.v", so we went ahead and did that since "$res.path" is an executable.')
res.path += '.v' res.path += '.v'
} }
} else if is_source_file(command) {
res.path = command
} }
if !res.is_bare && res.bare_builtin_dir != '' { if !res.is_bare && res.bare_builtin_dir != '' {
eprintln('`-bare-builtin-dir` must be used with `-freestanding`') eprintln('`-bare-builtin-dir` must be used with `-freestanding`')