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:
parent
3f67ba08b1
commit
448ed41562
@ -43,7 +43,7 @@ pub fn rmrf(path string) {
|
||||
verbose_trace(@FN, 'rm -rf $path')
|
||||
if os.exists(path) {
|
||||
if os.is_dir(path) {
|
||||
os.rmdir_recursive(path)
|
||||
os.rmdir_all(path)
|
||||
}else{
|
||||
os.rm(path)
|
||||
}
|
||||
|
@ -275,7 +275,7 @@ fn vpm_remove(module_names []string) {
|
||||
}
|
||||
println('Removing module "$name"...')
|
||||
verbose_println('removing folder $final_module_path')
|
||||
os.rmdir_recursive(final_module_path)
|
||||
os.rmdir_all(final_module_path)
|
||||
// delete author directory if it is empty
|
||||
author := name.split('.')[0]
|
||||
author_dir := os.realpath(filepath.join(settings.vmodules_path,author))
|
||||
|
@ -79,7 +79,7 @@ fn process_in_thread( session mut Session, thread_id int ){
|
||||
|
||||
tfolder := filepath.join( cdir, 'vrepl_tests_$idx')
|
||||
if os.is_dir( tfolder ) {
|
||||
os.rmdir_recursive( tfolder )
|
||||
os.rmdir_all( tfolder )
|
||||
}
|
||||
os.mkdir( tfolder ) or { panic(err) }
|
||||
|
||||
@ -89,14 +89,14 @@ fn process_in_thread( session mut Session, thread_id int ){
|
||||
fres := runner.run_repl_file(tfolder, session.options.vexec, file) or {
|
||||
session.bmark.fail()
|
||||
tls_bench.fail()
|
||||
os.rmdir_recursive( tfolder )
|
||||
os.rmdir_all( tfolder )
|
||||
eprintln(tls_bench.step_message_fail(err))
|
||||
assert false
|
||||
continue
|
||||
}
|
||||
session.bmark.ok()
|
||||
tls_bench.ok()
|
||||
os.rmdir_recursive( tfolder )
|
||||
os.rmdir_all( tfolder )
|
||||
println(tls_bench.step_message_ok(fres))
|
||||
assert true
|
||||
}
|
||||
|
@ -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')
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user