Adding check for Windows version and alternate flags for Windows Vista/7
This commit is contained in:
parent
9e9d74a5a4
commit
2d0e1c313a
1 changed files with 20 additions and 7 deletions
|
@ -340,13 +340,26 @@ bool MoveItemToTrash(const base::FilePath& path) {
|
||||||
|
|
||||||
// Elevation prompt enabled for UAC protected files. This overrides the
|
// Elevation prompt enabled for UAC protected files. This overrides the
|
||||||
// SILENT, NO_UI and NOERRORUI flags.
|
// SILENT, NO_UI and NOERRORUI flags.
|
||||||
if (FAILED(pfo->SetOperationFlags(FOF_NO_UI |
|
|
||||||
FOF_ALLOWUNDO |
|
if (base::win::GetVersion() >= base::win::VERSION_WIN8) {
|
||||||
FOF_NOERRORUI |
|
// Windows 8 introduces the flag RECYCLEONDELETE and deprecates the
|
||||||
FOF_SILENT |
|
// ALLOWUNDO in favor of ADDUNDORECORD.
|
||||||
FOFX_SHOWELEVATIONPROMPT |
|
if (FAILED(pfo->SetOperationFlags(FOF_NO_UI |
|
||||||
FOFX_RECYCLEONDELETE)))
|
FOFX_ADDUNDORECORD |
|
||||||
return false;
|
FOF_NOERRORUI |
|
||||||
|
FOF_SILENT |
|
||||||
|
FOFX_SHOWELEVATIONPROMPT |
|
||||||
|
FOFX_RECYCLEONDELETE)))
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
// For Windows 7 and Vista, RecycleOnDelete is the default behavior.
|
||||||
|
if (FAILED(pfo->SetOperationFlags(FOF_NO_UI |
|
||||||
|
FOF_ALLOWUNDO |
|
||||||
|
FOF_NOERRORUI |
|
||||||
|
FOF_SILENT |
|
||||||
|
FOFX_SHOWELEVATIONPROMPT)))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Create an IShellItem from the supplied source path.
|
// Create an IShellItem from the supplied source path.
|
||||||
base::win::ScopedComPtr<IShellItem> delete_item;
|
base::win::ScopedComPtr<IShellItem> delete_item;
|
||||||
|
|
Loading…
Reference in a new issue