Removes the directory dirname if it is empty. Returns false if it is missing, not empty, or not a directory.
To remove a folder with its content, see File_Utilities.delete_directory_tree.
delete_directory :: (dirname: string) -> bool
Parameters
- dirname: string
Returns
- bool
#import "Extensions/Environment";
base := environment_variable("TMPDIR");
if base == "" base = environment_variable("TEMP");
if base == "" base = "/tmp";
path := tprint("%/jai-doc-rmdir.bin", base);
defer file_delete(path);
directory := tprint("%.dir", path);
assert(make_directory_if_it_does_not_exist(directory));
assert(delete_directory(directory));
assert(!delete_directory(directory)); // goneDoesn't run in the browser (only on windows).