mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os api: rmdir_recursive => rmdir_all
This commit is contained in:
@@ -624,13 +624,18 @@ pub fn rmdir(path string) {
|
||||
}
|
||||
}
|
||||
|
||||
[deprecated]
|
||||
pub fn rmdir_recursive(path string) {
|
||||
panic('Use `os.rmdir_all` instead of `os.rmdir_recursive`')
|
||||
}
|
||||
|
||||
pub fn rmdir_all(path string) {
|
||||
items := os.ls(path) or {
|
||||
return
|
||||
}
|
||||
for item in items {
|
||||
if os.is_dir(filepath.join(path,item)) {
|
||||
rmdir_recursive(filepath.join(path,item))
|
||||
rmdir_all(filepath.join(path,item))
|
||||
}
|
||||
os.rm(filepath.join(path,item))
|
||||
}
|
||||
|
||||
@@ -303,8 +303,8 @@ fn cleanup_leftovers() {
|
||||
os.rm('cp_new_example.txt')
|
||||
|
||||
// possible leftovers from test_cp_r
|
||||
os.rmdir_recursive('ex')
|
||||
os.rmdir_recursive('ex2')
|
||||
os.rmdir_all('ex')
|
||||
os.rmdir_all('ex2')
|
||||
os.rm('ex1.txt')
|
||||
os.rm('ex2.txt')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user