diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2019-10-31 17:20:13 +0100 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2020-01-30 06:14:56 +0100 |
commit | 601ce9e08aa92b273f1a6daf0bdbc67dbf9b4e5f (patch) | |
tree | 732d1d1c57a5ae93da1af115807838ff7e188a29 /src/corelib/io/io.pri | |
parent | 7321a2c624d1a3bdc0825cf3d09a51643fe83d77 (diff) |
Implement moving of a single file system entry to the trash
This implements the operation for Windows, macOS, and Unix, for now
only as a private API (since QFileSystemEngine is private). This adds
the capability as a testable function; public API to be agreed on and
added in a separate commit.
The Unix implementation follows the freedesktop.org specification [1]
version 1.0.
[1] https://specifications.freedesktop.org/trash-spec/trashspec-1.0.html
On macOS and Windows, native APIs are used, with each having some
limitations:
* on macOS, the file in the trash won't have a "put back" option,
as we don't use Finder automation, for the reasons provided in the
comments
* on Windows, we might not be able to use the modern IFileOperation
API, e.g. if Qt is built with mingw which doesn't seem to provide
the interface definition; the fallback doesn't provide access to
the file name in the trash
The test case creates files and directories, and moves them to the
trash. As part of the cleanup routine, it deletes all file system
entries created. If run on Windows without IFileOperations support,
this will add a file in the trash for each test run, filling up
hard drive space.
Task-number: QTBUG-47703
Change-Id: I5f5f4e578be2f45d7da84f70a03acbe1a12a1231
Reviewed-by: Vitaly Fanaskov <vitaly.fanaskov@qt.io>
Diffstat (limited to 'src/corelib/io/io.pri')
-rw-r--r-- | src/corelib/io/io.pri | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri index c4c6f41387..a33ffe75f2 100644 --- a/src/corelib/io/io.pri +++ b/src/corelib/io/io.pri @@ -183,7 +183,9 @@ win32 { SOURCES += io/qstorageinfo_mac.cpp qtConfig(processenvironment): \ OBJECTIVE_SOURCES += io/qprocess_darwin.mm - OBJECTIVE_SOURCES += io/qstandardpaths_mac.mm + OBJECTIVE_SOURCES += \ + io/qstandardpaths_mac.mm \ + io/qfilesystemengine_mac.mm osx { LIBS += -framework DiskArbitration -framework IOKit } else { |