Commit 4c912de9 authored by Rob Swindell's avatar Rob Swindell 💬
Browse files

Have movefile() leave the original file with the delete attribute

This has the effect of the file being listed as absent/deleted in the listing that's in memory. As requested by Phil, plt via irc.

Moving a file after this change did result in a crash once, but I couldn't reproduce it with a debugger attached.
parent a40cda0c
Pipeline #2263 failed with stage
in 7 minutes and 3 seconds
......@@ -243,15 +243,15 @@ bool sbbs_t::removefile(smb_t* smb, file_t* f)
bool sbbs_t::movefile(smb_t* smb, file_t* f, int newdir)
file_t orgfile = *f;
file_t newfile = *f;
if(findfile(&cfg, newdir, f->name, NULL)) {
bprintf(text[FileAlreadyThere], f->name);
return false;
if(!addfile(&cfg, newdir, f, f->extdesc, /* client: */NULL))
if(!addfile(&cfg, newdir, &newfile, newfile.extdesc, /* client: */NULL))
return false;
if(!removefile(smb, &orgfile)) // Use ::removefile() here instead?
if(!removefile(smb, f)) // Use ::removefile() here instead?
return false;
......@@ -265,9 +265,9 @@ bool sbbs_t::movefile(smb_t* smb, file_t* f, int newdir)
/* move actual file */
char oldpath[MAX_PATH + 1];
getfilepath(&cfg, f, oldpath);
f->dir = newdir;
newfile.dir = newdir;
char newpath[MAX_PATH + 1];
getfilepath(&cfg, f, newpath);
getfilepath(&cfg, &newfile, newpath);
mv(oldpath, newpath, /* copy */false);
return true;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment