-Trying to create dir w/ illegal name shows As Admin button
Moderators: Hacker, petermad, Stefan2, white
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
-Trying to create dir w/ illegal name shows As Admin button
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.
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.
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
You are right, but I was speaking about creating directories.MarcinW wrote:Colon is also valid after the file name - for NTFS alternate data streams.Colon (':') is also illegal, except if it is at 2nd position in string and the 1st character is a letter.
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

So? Directories can have ADS as well.elgonzo wrote:You are right, but I was speaking about creating directories.
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
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
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
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
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64
Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
Ah, okay, now i understand what you mean. And i see now, where there might be a confusion/ambiguity.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.
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.
I disagree, and the reasons for that i explained already in my first post.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.
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...

-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
WFX don't seem to be related to the issue i am talking about.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
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?

- ghisler(Author)
- Site Admin
- Posts: 50541
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Sorry, I will not hard code characters here because some file systems (e.g. over the network) may still support them.
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.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?
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
-
- Power Member
- Posts: 872
- Joined: 2013-09-04, 14:07 UTC
Yes. It is so obvious. A bit embarrassing for me to not think about that, especially because i use the '\' and '|' from time to timeghisler(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.
