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:
parent
2a461704c4
commit
c8d825e1b3
Notes:
sideshowbarker
2024-07-18 02:52:04 +09:00
Author: https://github.com/krkk Commit: https://github.com/SerenityOS/serenity/commit/c8d825e1b34 Pull-request: https://github.com/SerenityOS/serenity/pull/10414
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue