os api: rmdir_recursive => rmdir_all
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))
|
||||
|
|
|
@ -8,7 +8,7 @@ import sync
|
|||
import filepath
|
||||
|
||||
fn test_the_v_compiler_can_be_invoked() {
|
||||
vexec := runner.full_path_to_v(5)
|
||||
vexec := runner.full_path_to_v(5)
|
||||
println('vexecutable: $vexec')
|
||||
assert vexec != ''
|
||||
vcmd := '"$vexec" --version'
|
||||
|
@ -73,30 +73,30 @@ fn process_in_thread( session mut Session, thread_id int ){
|
|||
session.ntask++
|
||||
idx := session.ntask-1
|
||||
session.ntask_mtx.unlock()
|
||||
|
||||
|
||||
if idx >= session.options.files.len { break }
|
||||
tls_bench.cstep = idx
|
||||
|
||||
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) }
|
||||
|
||||
file := session.options.files[ idx ]
|
||||
|
||||
file := session.options.files[ idx ]
|
||||
session.bmark.step()
|
||||
tls_bench.step()
|
||||
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