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

pull/6881/head
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
1 changed files with 5 additions and 0 deletions

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