Skip to content
Snippets Groups Projects
Commit 319dba05 authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
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 b8628152
No related branches found
No related tags found
No related merge requests found
......@@ -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;
bprintf(text[MovedFile],f->name
,cfg.lib[cfg.dir[newdir]->lib]->sname,cfg.dir[newdir]->sname);
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment