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

examples: make examples/templates/templates.v runable from everywhere, not just .

This commit is contained in:
Delyan Angelov 2021-02-19 17:29:35 +02:00
parent bcb35e15f9
commit 3a65ccd060
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -171,11 +171,11 @@ fn data_get() []SiteConfig {
fn data_dump(data []SiteConfig) {
a := json.encode_pretty(data)
os.write_file('data.json', a) or { panic(err) }
os.write_file(os.resource_abs_path('data.json'), a) or { panic(err) }
}
fn data_load() []SiteConfig {
data := os.read_file('data.json') or { panic(err) }
data := os.read_file(os.resource_abs_path('data.json')) or { panic(err) }
a := json.decode([]SiteConfig, data) or { panic(err) }
return a
}