mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
word_counter: handle bad path
This commit is contained in:
parent
69a363472f
commit
92ecd0ca7c
@ -13,7 +13,10 @@ fn main() {
|
|||||||
else {
|
else {
|
||||||
path = os.args[1]
|
path = os.args[1]
|
||||||
}
|
}
|
||||||
contents := os.read_file(path.trim_space())
|
contents := os.read_file(path.trim_space()) or {
|
||||||
|
println('failed to open $path')
|
||||||
|
return
|
||||||
|
}
|
||||||
mut m := map[string]int{}
|
mut m := map[string]int{}
|
||||||
for word in contents.to_lower().split(' ') {
|
for word in contents.to_lower().split(' ') {
|
||||||
key := filter_word(word)
|
key := filter_word(word)
|
||||||
|
Loading…
Reference in New Issue
Block a user