1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compile: infer source file if a binary by the same name exists in same dir #6877

This commit is contained in:
Larpon 2020-11-19 16:23:55 +01:00 committed by GitHub
parent 268e3b5d15
commit f807fd973e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -409,6 +409,11 @@ pub fn parse_args(args []string) (&Preferences, string) {
res.path = args[command_pos + 1]
res.run_args = args[command_pos + 2..]
must_exist(res.path)
if !res.path.ends_with('.v') && os.is_executable(res.path) && os.is_file(res.path) &&
os.is_file(res.path + '.v') {
eprintln('It looks like you wanted to run `v $res.path`, so we went ahead and did that since "$res.path" is an executable.')
res.path += '.v'
}
}
if command == 'build-module' {
res.build_mode = .build_module