Revert "Revert "builder: create the binary in the current directory if -o is not provided""
This reverts commit f2b73fe3ca
.
pull/9441/head
parent
ae6420afc7
commit
6463dfca29
|
@ -12,14 +12,14 @@ vlib/v/checker/tests/in_mismatch_type.vv:13:5: error: left operand to `in` does
|
||||||
| ~~~~~~
|
| ~~~~~~
|
||||||
14 | println('yeah')
|
14 | println('yeah')
|
||||||
15 | }
|
15 | }
|
||||||
vlib/v/checker/tests/in_mismatch_type.vv:16:5: error: left operand to `in` does not match: expected `string`, not `int literal`
|
vlib/v/checker/tests/in_mismatch_type.vv:16:5: error: use `str.contains(substr)` instead of `substr in str`
|
||||||
14 | println('yeah')
|
14 | println('yeah')
|
||||||
15 | }
|
15 | }
|
||||||
16 | if 3 in s {
|
16 | if 3 in s {
|
||||||
| ~~~~~~
|
| ~~~~~~
|
||||||
17 | println('dope')
|
17 | println('dope')
|
||||||
18 | }
|
18 | }
|
||||||
vlib/v/checker/tests/in_mismatch_type.vv:19:5: error: left operand to `in` does not match: expected `string`, not `rune`
|
vlib/v/checker/tests/in_mismatch_type.vv:19:5: error: use `str.contains(substr)` instead of `substr in str`
|
||||||
17 | println('dope')
|
17 | println('dope')
|
||||||
18 | }
|
18 | }
|
||||||
19 | if `a` in s {
|
19 | if `a` in s {
|
||||||
|
|
|
@ -46,8 +46,10 @@ pub fn (mut p Preferences) fill_with_defaults() {
|
||||||
// The file name is just `.v` or `.vsh` or `.*`
|
// The file name is just `.v` or `.vsh` or `.*`
|
||||||
base = filename
|
base = filename
|
||||||
}
|
}
|
||||||
target_dir := if os.is_dir(rpath) { rpath } else { os.dir(rpath) }
|
// target_dir := if os.is_dir(rpath) { rpath } else { os.dir(rpath) }
|
||||||
p.out_name = os.join_path(target_dir, base)
|
// If no "-o" was supplied, create the binary in the current
|
||||||
|
// directory. This is the behavior of Go, Clang, GCC, etc.
|
||||||
|
p.out_name = os.join_path(os.getwd(), base)
|
||||||
if rpath == '$p.vroot/cmd/v' && os.is_dir('vlib/compiler') {
|
if rpath == '$p.vroot/cmd/v' && os.is_dir('vlib/compiler') {
|
||||||
// Building V? Use v2, since we can't overwrite a running
|
// Building V? Use v2, since we can't overwrite a running
|
||||||
// executable on Windows + the precompiled V is more
|
// executable on Windows + the precompiled V is more
|
||||||
|
|
|
@ -348,6 +348,18 @@ fn return_sb_str() string {
|
||||||
return sb.str() // sb should be freed, but only after .str() is called
|
return sb.str() // sb should be freed, but only after .str() is called
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn parse_header0(s string) ?string {
|
||||||
|
if !s.contains(':') {
|
||||||
|
return error('missing colon in header')
|
||||||
|
}
|
||||||
|
words := s.split_nth(':', 2)
|
||||||
|
return words[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
fn advanced_optionals() {
|
||||||
|
s := parse_header0('foo:bar') or { return }
|
||||||
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println('start')
|
println('start')
|
||||||
simple()
|
simple()
|
||||||
|
@ -374,6 +386,7 @@ fn main() {
|
||||||
s2 := return_sb_str()
|
s2 := return_sb_str()
|
||||||
// free_map()
|
// free_map()
|
||||||
// loop_map()
|
// loop_map()
|
||||||
|
// advanced_optionals()
|
||||||
free_array_except_returned_element()
|
free_array_except_returned_element()
|
||||||
println('end')
|
println('end')
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue