[tc10.51rc2] error handling of LOADLIST

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

Moderators: white, Hacker, petermad, Stefan2

User avatar
white
Power Member
Power Member
Posts: 4576
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

[tc10.51rc2] error handling of LOADLIST

Post by *white »

  • Create a button with Command "LOADLIST c:\test\list.txt"
  • Create a new folder with 2 files "test1.txt" and "test2.txt" (with any content)
Apparently wildcards in list files can be loaded. For example put this in c:\test\list.txt:

Code: Select all

*.txt
Click the button and the 2 test files are loaded.

However all lines with wildcards in it will be counted to determine if the error list should be shortened.
A maximum of 5 incorrect lines are shown in the error message. If there are more errors, only the first 5 are shown followed by "..."
Add 5 non-existing files to c:\test\list.txt, so the contents of the file looks something like this:

Code: Select all

*.txt
crap1
crap2
crap3
crap4
crap5
Click the button and the error says there are 5 errors. 5 errors are displayed followed by "..." indicating there are more errors..
Now remove *.txt from the list file, click the button again and you see that "..." is not displayed in the error message.

Regular expressions can't be loaded and give strange results.
Put the following lines in c:\test\list.txt:

Code: Select all

<crap
crap1
crap2
crap3
crap4
crap5
Click the button and you will see that this works OK. The error says 6 errors and the first 5 errors are listed.
Now test a line with "<" followed by the end of an existing filename. At least the full extension must be included.
Put for example the following lines in c:\test\list.txt:

Code: Select all

<txt
crap1
crap2
crap3
crap4
crap5
Click the button and..
Apparently TC finds something and displays the current folder followed by "<txt" in the file panel.
The entry is not counted as an error, the error message says there are 5 errors, not 6.
However at the bottom "..." is displayed indicating there are more errors.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [tc10.51rc2] error handling of LOADLIST

Post by *ghisler(Author) »

Regular expressions are not supported by LOADLIST. I will just add the search string to the error list.
However, I cannot reproduce this:
Apparently TC finds something and displays the current folder followed by "<txt" in the file panel.
What file was found when you looked for <txt?
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4576
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [tc10.51rc2] error handling of LOADLIST

Post by *white »

ghisler(Author) wrote: 2022-08-24, 07:06 UTC
Apparently TC finds something and displays the current folder followed by "<txt" in the file panel.
What file was found when you looked for <txt?
What I said:
white wrote: 2022-08-23, 17:07 UTC Now test a line with "<" followed by the end of an existing filename. At least the full extension must be included.
So the following all find a match if a file named "test1.txt" exists:
<txt
<.txt
<1.txt
<t1.txt
<st1.txt
<est1.txt
<test1.txt

And when any match is found, the match is not displayed in the file panel. But instead the search string is displayed 1 time. In my case:
c:\test\<txt
c:\test\<.txt
c:\test\<1.txt
c:\test\<t1.txt
c:\test\<st1.txt
c:\test\<est1.txt
c:\test\<test1.txt
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [tc10.51rc2] error handling of LOADLIST

Post by *ghisler(Author) »

So the following all find a match if a file named "test1.txt" exists:
I cannot reproduce that. But I will just filter out all search strings with < in them, so it should handle your problem.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4576
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [tc10.51rc2] error handling of LOADLIST

Post by *white »

Perhaps add to the Help: Wildcards can also be used, but regular expressions are not supported.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [tc10.51rc2] error handling of LOADLIST

Post by *ghisler(Author) »

Too late for RC3, sorry. Maybe in the next.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4576
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [tc10.51rc2] error handling of LOADLIST

Post by *white »

Entries in list file:

Code: Select all

*.txt
Result OK. Files with paths are shown.



While the search results are still being displayed, load the same list again:

Code: Select all

*.txt
Result: Files without paths are shown. :?:



While the search results are still being displayed, load list with some added errors:

Code: Select all

*.txt
crap1
crap2
crap3
crap4
crap5
.txt files in TC's program folder are shown. :?:



Entries in list file:

Code: Select all

<txt
Result: Error count is 2. :?:



If the list file is 0 bytes then no empty search results list is loaded and error "No files found!" is displayed.
If the list file contains only 1 or more empty lines then an empty list is loaded and error "File not found!" is displayed. :?:

If the list file only contains non-existing files then an empty list is loaded and the error is displayed. :?:


User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [tc10.51rc2] error handling of LOADLIST

Post by *ghisler(Author) »

LOADLIST uses the current directory when you use it while in a search result. I don't want to disable it because the user can specify a path in the search too, e.g.
c:\path\*.ext
Result: Error count is 2. :?:
Very strange indeed, I will check it in the debugger.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4576
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [tc10.51rc2] error handling of LOADLIST

Post by *white »

ghisler(Author) wrote: 2022-08-24, 13:40 UTC LOADLIST uses the current directory when you use it while in a search result.
That's the point, I wasn't in TC's program folder.
File names found in current folder are displayed without path (when you do LOADLIST when in search result).
Apparently now the current folder for the search results panel is TC's program folder. If you try to copy the files, it will try to copy them from TC's program folder and fail. If you try LOADLIST again it will search TC's program folder.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [tc10.51rc2] error handling of LOADLIST

Post by *ghisler(Author) »

So what would you suggest? Just fail LOADLIST when not in a directory? Or just when the list doesn't contain full paths? Even then it can contain a mix of just names/wildcards and paths+names/wildcards...
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4576
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [tc10.51rc2] error handling of LOADLIST

Post by *white »

When no files are found, please don't show an empty list. That's not useful in any way. Only display the same error as when the list file is empty.
So when the list file for example only contains *.exe, and no .exe files are found, don't show an empty list but show the "No files found!" error.
And if the list file (also) contains only files that do not exist, do the same. I don't think it's necessary to show the file count and a partial list of not found files if none of the files are found.
ghisler(Author) wrote: 2022-08-24, 16:31 UTC So what would you suggest? Just fail LOADLIST when not in a directory? Or just when the list doesn't contain full paths? Even then it can contain a mix of just names/wildcards and paths+names/wildcards...
In my opinion LOADLIST shouldn't fail so you can quickly load different lists and see the results.

Like the help says "If no path is provided, the current directory is assumed" . If a panel contains search results, it still has a current directory, which is the directory when you press F2 (Reread). Loading the same list 2 times in a row should give the same results. Loading different lists in a row should give the results for the current directory.
User avatar
white
Power Member
Power Member
Posts: 4576
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [tc10.51rc2] error handling of LOADLIST

Post by *white »

Entries with wildcard characters in the path never throw a not found error.
c:\test*123\test1.txt
\\?\c:\test1.txt:Zone.Identifier
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [tc10.51rc2] error handling of LOADLIST

Post by *ghisler(Author) »

They are invalid and are ignored.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4576
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: [tc10.51rc2] error handling of LOADLIST

Post by *white »

Entries that are invalid show up as file not found. TC considers the entries I named valid wildcard entries. And if such entries doesn't result in any files, then no error is displayed because a wildcard means zero or more files that match.

Code: Select all

|test                    (file not found error)
>test                    (file not found error)
<test                    (file not found error)
c:\test\:::invalid:::    (file not found error)
c:\te*st\:::invalid:::   (no error)
c:\test\:::inva*lid:::   (no error, but acceptable)
UNC paths work just fine. Also using paths with \\?\ work fine, except when the file does not exist. Then no file not found error is displayed.

Code: Select all

\\?\c:\test\test1.txt                   (works OK)
\\?\c:\test\*.txt                       (works OK)
\\?\c:\thisfiledoesnotexist.txt         (no file not found error)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48012
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [tc10.51rc2] error handling of LOADLIST

Post by *ghisler(Author) »

Well, Total Commander just passes the paths to FindFirstFile, and the help for that Windows function doesn't mention wildcards in the path part:
https://docs.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-findfirstfilea
Author of Total Commander
https://www.ghisler.com
Post Reply