tools: prevent v init from overwriting an already existing src/main.v file (fix #17362) (#17363)

This commit is contained in:
Sanath Kumar U 2023-02-20 16:24:38 +05:30 committed by GitHub
parent cb976c7e17
commit 269462425a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 11 deletions

View file

@ -133,10 +133,11 @@ fn init_project() {
c.write_vmod(false)
println('Change the description of your project in `v.mod`')
}
c.files << ProjectFiles{
path: 'src/main.v'
content: hello_world_content()
if !os.exists('src/main.v') {
c.files << ProjectFiles{
path: 'src/main.v'
content: hello_world_content()
}
}
c.create_files_and_directories()
c.write_gitattributes(false)