From 4947a16af6c8e33f697a8da222db7f3ad027ba94 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Tue, 16 Mar 2021 03:01:13 +0000 Subject: CTAN sync 202103160301 --- graphics/asymptote/util.cc | 52 ---------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'graphics/asymptote/util.cc') diff --git a/graphics/asymptote/util.cc b/graphics/asymptote/util.cc index 81398491c0..85e9320cfd 100644 --- a/graphics/asymptote/util.cc +++ b/graphics/asymptote/util.cc @@ -398,58 +398,6 @@ const char *setPath(const char *s, bool quiet) return p; } -void fatal(const char *msg, const char *s=NULL) -{ - ostringstream buf; - buf << msg; - if(s) { - buf << " " << getPath(); - if(*s) buf << "/"; - buf << s; - } - buf << ": " << strerror(errno) << endl; - camp::reportError(buf); -} - -void empty_current_dir() -{ - static struct stat buf; - DIR *dir=opendir("."); - if(dir == NULL) fatal("Cannot open directory",""); - dirent *p; - while((p=readdir(dir)) != NULL) { - if(strcmp(p->d_name,".") == 0 || strcmp(p->d_name,"..") == 0) continue; - if(lstat(p->d_name,&buf) == 0) { - if(S_ISDIR(buf.st_mode)) { - if(chdir(p->d_name)) fatal("Cannot change directory to",p->d_name); - empty_current_dir(); - if(chdir("..")) - fatal("Cannot change to parent directory of",p->d_name); - if(rmdir(p->d_name)) - fatal("Cannot remove directory",p->d_name); - } else { - if(unlink(p->d_name)) fatal("Cannot remove file",p->d_name); - } - } - } - if(closedir(dir)) fatal("Invalid current directory stream descriptor"); -} - -void recursive_delete(char *name) -{ - static struct stat buf; - if(lstat(name,&buf) == 0) { - if(S_ISDIR(buf.st_mode)) { - const char *path=getPath(); - if(chdir(name)) fatal("Cannot change directory to",name); - empty_current_dir(); - if(chdir(path)) fatal("Cannot change to directory",""); - if(rmdir(name)) fatal("Cannot remove directory", name); - } - else unlink(name); - } -} - void push_command(mem::vector& a, const string& s) { a.push_back(s); -- cgit v1.2.3