Skip to content
Snippets Groups Projects
Commit caed3600 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Simplify the file remove/delete logic here.

parent 90bf6cd5
Branches
Tags
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #2209 passed
......@@ -844,39 +844,36 @@ int sbbs_t::listfileinfo(uint dirnum, const char *filespec, long mode)
editfileinfo(f);
break;
case 'F': /* delete file only */
SAFEPRINTF2(str,"%s%s",dirpath,f->name);
if(!fexistcase(str))
bprintf(text[FileDoesNotExist],str);
getfilepath(&cfg, f, path);
if(!fexistcase(path))
bprintf(text[FileDoesNotExist], path);
else {
if(!noyes(text[DeleteFileQ])) {
if(remove(str))
bprintf(text[CouldntRemoveFile],str);
else {
SAFEPRINTF(tmp, "deleted %s", str);
logline(nulstr, tmp);
}
if(remove(path) != 0) {
bprintf(text[CouldntRemoveFile], path);
errormsg(WHERE, ERR_REMOVE, path);
} else
lprintf(LOG_NOTICE, "deleted %s", path);
}
}
break;
case 'R': /* remove file from database */
if(noyes(text[RemoveFileQ]))
break;
if(removefile(&smb, f)) {
if(!removefile(&smb, f)) {
errormsg(WHERE, ERR_REMOVE, f->name);
break;
}
getfilepath(&cfg, f, path);
if(fexistcase(path)) {
if(dir_op(dirnum)) {
if(!noyes(text[DeleteFileQ])) {
if(remove(path) != 0)
errormsg(WHERE, ERR_REMOVE, path);
else {
SAFEPRINTF(tmp, "deleted %s", path);
logline(nulstr,path);
}
}
}
else if(remove(path)) /* always remove if not sysop */
if(dir_op(dirnum) && noyes(text[DeleteFileQ]))
break;
if(remove(path) != 0) {
bprintf(text[CouldntRemoveFile], path);
errormsg(WHERE, ERR_REMOVE, path);
break;
}
lprintf(LOG_NOTICE, "deleted %s", path);
}
if(dir_op(dirnum) || useron.exempt&FLAG('R')) {
i=cfg.lib[cfg.dir[f->dir]->lib]->offline_dir;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment