fetch_configurationpath (dpath, sizeof (dpath) / sizeof (TCHAR));
_tcscat (dpath, _T("configuration.backup"));
bool hidden = my_isfilehidden (dpath);
- my_unlink (dpath);
+ my_unlink (dpath, true);
my_rename (path, dpath);
if (hidden)
my_setfilehidden (dpath, hidden);
return;
}
} else {
- if (my_unlink (a->nname) == -1) {
+ if (my_unlink (a->nname, false) == -1) {
PUT_PCK_RES1 (packet, DOS_FALSE);
PUT_PCK_RES2 (packet, dos_errno ());
return;
extern int my_rmdir (const TCHAR*);
extern int my_mkdir (const TCHAR*);
-extern int my_unlink (const TCHAR*);
+extern int my_unlink (const TCHAR*, bool);
extern int my_rename (const TCHAR*, const TCHAR*);
extern int my_setcurrentdir (const TCHAR *curdir, TCHAR *oldcur);
bool my_isfilehidden (const TCHAR *path);
return CreateDirectory (namep, NULL) == 0 ? -1 : 0;
}
-static int recycle (const TCHAR *name)
+static int recycle (const TCHAR *name, bool dontrecycle)
{
DWORD dirattr = GetFileAttributesSafe (name);
bool isdir = dirattr != INVALID_FILE_ATTRIBUTES && (dirattr & FILE_ATTRIBUTE_DIRECTORY);
namep = name;
}
- if (currprefs.win32_norecyclebin || isdir || currprefs.win32_filesystem_mangle_reserved_names == false) {
+ if (dontrecycle || currprefs.win32_norecyclebin || isdir || currprefs.win32_filesystem_mangle_reserved_names == false) {
if (isdir)
return RemoveDirectory (namep) ? 0 : -1;
else
return -1;
}
- return recycle (name);
+ return recycle (name, false);
}
/* "move to Recycle Bin" (if enabled) -version of DeleteFile() */
-int my_unlink (const TCHAR *name)
+int my_unlink (const TCHAR *name, bool dontrecycle)
{
- return recycle (name);
+ return recycle (name, dontrecycle);
}
int my_rename (const TCHAR *oldname, const TCHAR *newname)
if (SUCCEEDED(hres))
{
// Get the path to the link target.
- hres = psl->GetPath(szGotPath, MAX_DPATH, (WIN32_FIND_DATA*)&wfd, SLGP_SHORTPATH);
+ hres = psl->GetPath(szGotPath, MAX_DPATH, &wfd, SLGP_SHORTPATH);
if (SUCCEEDED(hres))
{
if (ext && !_tcsicmp (ext, _T(".tape"))) {
_stprintf (path, _T("%s%s%s"), tape->tape_dir, FSDB_DIR_SEPARATOR_S, filename);
if (my_existsfile (path))
- my_unlink (path);
+ my_unlink (path, false);
}
}
my_closedir (od);