-Trying to create dir w/ illegal name shows As Admin button

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

-Trying to create dir w/ illegal name shows As Admin button

Post by *gdpr deleted 6 »

Okay, this is probably only a cosmetic issue (it does not harm, and it does not prevent you to get your stuff done in TC). Anyway...

When trying to create a directory with an illegal name (such as "hello:world" or "hello<world", etc...), an error dialog is shown. Strangely, the dialog also offers an "As Administrator" button, which is pointless in such cases.

Observed on both the current TC8.50b5 and TC8.01.

I thought i mention it, since a probable fix could likely be hiding the "As Administrator" button depending on the result of just a handful of String::IndexOf(char) (or the equivalent Pascal function) invocations.

Illegal characters in directory names are '<', '>', '?' , '*' ('|','/','\' are used by TC to create multiple dirs at once, so regarding this use case they are legit).
Colon (':') is also illegal, except if it is at 2nd position in string and the 1st character is a letter.
Double quote character is also illegal, if it appears within the string.

Copy dialog has a similar behavior of showing "As Administrator" button when a syntactically illegal target path is being entered.
Move dialog shows different behavior when providing an illegal target path, depending on whether only one or many files are selected, but generally it is also oblivious to the reason of why the move has actually failed.
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Colon (':') is also illegal, except if it is at 2nd position in string and the 1st character is a letter.
Colon is also valid after the file name - for NTFS alternate data streams.
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

MarcinW wrote:
Colon (':') is also illegal, except if it is at 2nd position in string and the 1st character is a letter.
Colon is also valid after the file name - for NTFS alternate data streams.
You are right, but I was speaking about creating directories.
Also, i am not sure how you would handle such a NTFS alternate file stream separator token in the target path meaningfully when copying/moving multiple files in TC :?
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

elgonzo wrote:but I was speaking about creating directories.
My fault, you are of course right :)
User avatar
Dalai
Power Member
Power Member
Posts: 9966
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

elgonzo wrote:You are right, but I was speaking about creating directories.
So? Directories can have ADS as well.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

Dalai wrote:
elgonzo wrote:You are right, but I was speaking about creating directories.
So? Directories can have ADS as well.

Regards
Dalai
What are you trying to say, and how does it relate to the discussion above?
User avatar
Dalai
Power Member
Power Member
Posts: 9966
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Post by *Dalai »

There are fewer illegal characters in filenames than you might think. A colon is not an illegal character, neither for files nor directories [ADD](only on NTFS of course, on other filesystems it's illegal)[/ADD].

I think it's too much hassle to worry about illegal characters to decide whether the button "As Administrator" should be displayed or not.

Regards
Dalai
Last edited by Dalai on 2013-10-09, 12:43 UTC, edited 1 time in total.
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

Dalai wrote:There are fewer illegal characters in filenames than you might think. A colon is not an illegal character, neither for files nor directories.
Ah, okay, now i understand what you mean. And i see now, where there might be a confusion/ambiguity.

As i was speaking about TC's "Create Directory" function, i used the terms "legal" / "illegal" characters within this context, not with respect to a file system.
For example, '|' is not a legal character for a directory name. But in the context of TC's "Create Directory" function, it is nevertheless a totally legit character to enter in the "Create Directory" text field.

On the other hand, ADS separators have no usage with regard to the functions of TC i mentioned earlier. Perhaps you might come up with functions for TC where using ADS separators makes sense, but then those functions would need to be implemented in TC first - and i think that that would really be not necessary.
Dalai wrote: I think it's too much hassle to worry about illegal characters to decide whether the button "As Administrator" should be displayed or not.
I disagree, and the reasons for that i explained already in my first post.
Offering an "As Administrator" button for what is clearly an input error really looks ridiculous (no offence intended).

But at the end of the day, it is ghisler's judgement and decision, since he is the one who knows the code and plans his work items... :)
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Mhmm, hardcoding a list of characters that are not allowed might cause problems with filesystems other than FAT/NTFS - which can be mounted by using WFX plugins. It's hard to predict what filesystems will be used with Total Commander and which characters are not allowed with them.

Regards
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

MarcinW wrote:Mhmm, hardcoding a list of characters that are not allowed might cause problems with filesystems other than FAT/NTFS - which can be mounted by using WFX plugins. It's hard to predict what filesystems will be used with Total Commander and which characters are not allowed with them.

Regards
WFX don't seem to be related to the issue i am talking about.

Because, as it seems to me, in case of a WFX, TC just passes the input string to the plug-in, and it is in the responsibility of the plug-in to do error handling.

VirtualPanel, for instance, just does an audible ping as error message, but does not show an error dialog, when i try to create an illegal folder such as "\\\".

However, if i try to create such an illegal folder in TC (not through WFX), TC displays an error dialog with a signal tone that is different from VirtualPanel.

That is a pretty strong indication that WFX plug-ins by design have to care about their own error handling. Which, if true, means in consequence that for the problem i described WFX plug-ins are of no concern.

EDIT: I just noticed, that the error dialog for trying to create a dir like "\\\" is different from the error dialog for trying to create a dir like "hello:world". Huh? :shock:
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, I will not hard code characters here because some file systems (e.g. over the network) may still support them.
EDIT: I just noticed, that the error dialog for trying to create a dir like "\\\\" is different from the error dialog for trying to create a dir like "hello:world". Huh?
That's because when you specify something like dir1\dir2\dir3, TC will create the 3 directories in this order as a complete path. So in the above example, TC splits up \\\\ into multiple parts and tries to create the folders.
Author of Total Commander
https://www.ghisler.com
gdpr deleted 6
Power Member
Power Member
Posts: 872
Joined: 2013-09-04, 14:07 UTC

Post by *gdpr deleted 6 »

ghisler(Author) wrote: That's because when you specify something like dir1\dir2\dir3, TC will create the 3 directories in this order as a complete path. So in the above example, TC splits up \\\\ into multiple parts and tries to create the folders.
Yes. It is so obvious. A bit embarrassing for me to not think about that, especially because i use the '\' and '|' from time to time :oops:
Post Reply