Jump to page: 1 2
Thread overview
[Issue 15102] Unified function to remove files/directories
Oct 15, 2015
Vladimir Panteleev
Oct 15, 2015
Jacob Carlborg
Oct 15, 2015
Vladimir Panteleev
Oct 15, 2015
Jacob Carlborg
Oct 15, 2015
Vladimir Panteleev
Oct 15, 2015
Jacob Carlborg
Oct 15, 2015
Vladimir Panteleev
Oct 15, 2015
Vladimir Panteleev
Nov 03, 2015
Vladimir Panteleev
Dec 17, 2022
Iain Buclaw
October 15, 2015
https://issues.dlang.org/show_bug.cgi?id=15102

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |thecybershadow@gmail.com

--- Comment #1 from Vladimir Panteleev <thecybershadow@gmail.com> ---
Why? This corresponds to neither how the OS APIs work nor how it's done in the shell - there are separate commands to remove a file, directory or a directory and its contents.

If the program created a file/directory, it should already know what sort of filesystem object it is. I can't think of many situations where this would be useful.

--
October 15, 2015
https://issues.dlang.org/show_bug.cgi?id=15102

--- Comment #2 from Jacob Carlborg <doob@me.com> ---
(In reply to Vladimir Panteleev from comment #1)
> Why? This corresponds to neither how the OS APIs work nor how it's done in the shell - there are separate commands to remove a file, directory or a directory and its contents.

I don't think that matters at all. Why would we build all these abstractions in the first place?

> If the program created a file/directory, it should already know what sort of filesystem object it is. I can't think of many situations where this would be useful.

Yes, but I can't imagine why I would want to use separate API's for that. Do you want to use different operators for addition for "long" and for "int" as well? I mean, I assume you know what type it is.

--
October 15, 2015
https://issues.dlang.org/show_bug.cgi?id=15102

--- Comment #3 from Vladimir Panteleev <thecybershadow@gmail.com> ---
Files and directories are completely different objects in how they behave. Your analogy doesn't hold - a better analogy would be having separate operators for adding strings and ints.

--
October 15, 2015
https://issues.dlang.org/show_bug.cgi?id=15102

--- Comment #4 from Jacob Carlborg <doob@me.com> ---
I don't agree.

BTW, in a GUI it's the same operation for all there cases.

--
October 15, 2015
https://issues.dlang.org/show_bug.cgi?id=15102

--- Comment #5 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to Jacob Carlborg from comment #4)
> BTW, in a GUI it's the same operation for all there cases.

Not at all, unless it's a very poor GUI.

A good file manager will display to the user the type of object the user is about to delete for confirmation. Additionally, if the directory is not empty, an additional (or more noticeable) confirmation should be displayed.

You still haven't provided a good use case.

--
October 15, 2015
https://issues.dlang.org/show_bug.cgi?id=15102

--- Comment #6 from Jacob Carlborg <doob@me.com> ---
(In reply to Vladimir Panteleev from comment #5)
> (In reply to Jacob Carlborg from comment #4)
> > BTW, in a GUI it's the same operation for all there cases.
> 
> Not at all, unless it's a very poor GUI.

I said "same operation", i.e. clicking on the same menu item/button.

> A good file manager will display to the user the type of object the user is about to delete for confirmation. Additionally, if the directory is not empty, an additional (or more noticeable) confirmation should be displayed.

On OS X, both Finder and Path Finder behave like this:

If a file, empty directory or non-empty directory is put in the trash no confirmation are required. When the trash is emptied there's a generic confirmation, regardless of the content.

For something that would bypass the trash, i.e. removing from a network drive, a confirmation is required. But the it's the same message for all three cases.

For Debian with MATE, Debian with Gnome and Windows 10, it's the same as well.

> You still haven't provided a good use case.

The only reason why you might want to have separate functions is because of performance reasons. But that's no reason why there can't be a unified function.

--
October 15, 2015
https://issues.dlang.org/show_bug.cgi?id=15102

--- Comment #7 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to Jacob Carlborg from comment #6)
> On OS X, both Finder and Path Finder behave like this:

Try the operation that bypasses the recycle bin or equivalent.

In either case, you will be doing the deletion from a view which already displays what type the filesystem object is (e.g. via a file/folder icon), so the file manager will already know the object type when it's doing the deletion.

> The only reason why you might want to have separate functions is because of performance reasons. But that's no reason why there can't be a unified function.

Performance has nothing to do with it. There are two issues:

1. Bloat. It's dumb to bloat the stdlib with functions that can be written in a few lines of code and will be used once in a blue moon.

2. Atomicity. There is no simple way to atomically check what type an object is and perform the corresponding operation. Between the check and the operation the filesystem may have changed, and ugly things might happen. This is the same reason why "rename" has no "bool overwrite" - overwriting is always on, because that's what the OS API provides. In theory you could rename the object to an unique name, check its type, and then do the appropriate operation, but this sort of complicated machinations are best left for user code.

--
October 15, 2015
https://issues.dlang.org/show_bug.cgi?id=15102

--- Comment #8 from Vladimir Panteleev <thecybershadow@gmail.com> ---
(In reply to Jacob Carlborg from comment #6)
> For Debian with MATE, Debian with Gnome and Windows 10, it's the same as well.

FWIW, Windows 7 says "file" or "folder" in the message depending on what you're deleting. Gnome (not sure which version) uses the same message (to save on localization costs, I guess) but shows a big icon of the item you're about to delete.

--
November 03, 2015
https://issues.dlang.org/show_bug.cgi?id=15102

Vladimir Panteleev <thecybershadow@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=3862

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=15102

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
« First   ‹ Prev
1 2