SpaceAnalyzer: Make files removable depending on directory permissions

Prior this patch, you couldn't remove any files from the context menu
if you didn't have write access to them.

It was incorrect, as the write permission for files means that you can
modify the contents of the file, where for directories it means that
you can create, rename, and remove the files there.
This commit is contained in:
Karol Kosek 2021-10-07 21:59:22 +02:00 committed by Andreas Kling
parent 2a461704c4
commit c8d825e1b3
Notes: sideshowbarker 2024-07-18 02:52:04 +09:00

View file

@ -231,7 +231,7 @@ static void analyze(RefPtr<Tree> tree, SpaceAnalyzer::TreeMapWidget& treemapwidg
static bool is_removable(const String& absolute_path)
{
VERIFY(!absolute_path.is_empty());
int access_result = access(absolute_path.characters(), W_OK);
int access_result = access(LexicalPath::dirname(absolute_path).characters(), W_OK);
if (access_result != 0 && errno != EACCES)
perror("access");
return access_result == 0;