summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfile.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2024-06-24 13:40:25 -0700
committerThiago Macieira <thiago.macieira@intel.com>2024-06-25 08:12:39 -0700
commit3302b0cdc15995fb9e70cf9e911d3ab408691b42 (patch)
tree81bf719e687374c43d02a480d7b617fa6577be80 /src/corelib/io/qfile.cpp
parenta2631f5bc0f5a71789231e8154f438552395c7bc (diff)
QFile::moveToTrash/Unix: ensure we try to remove the proper source
We already had code to strip ending slashes, which makes sense if trying to trash directories. In the case of symlinks to directories, that also changes from trashing the directory to trashing the symlink. But had to removeFile() on the same modified path. Fixes: QTBUG-126621 Pick-to: 6.7 6.8 Change-Id: I46feca3a447244a8ba19fffd17dc0b56f2b1c68c Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'src/corelib/io/qfile.cpp')
-rw-r--r--src/corelib/io/qfile.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/io/qfile.cpp b/src/corelib/io/qfile.cpp
index ea594470eae..1ca5eea01e2 100644
--- a/src/corelib/io/qfile.cpp
+++ b/src/corelib/io/qfile.cpp
@@ -462,7 +462,9 @@ QFile::remove(const QString &fileName)
//! [move-to-trash-common]
The time for this function to run is independent of the size of the file
being trashed. If this function is called on a directory, it may be
- proportional to the number of files being trashed.
+ proportional to the number of files being trashed. If the current
+ fileName() points to a symbolic link, this function will move the link to
+ the trash, possibly breaking it, not the target of the link.
This function uses the Windows and \macos APIs to perform the trashing on
those two operating systems. Elsewhere (Unix systems), this function