Lister detect files with no extension

English support forum

Moderators: white, sheep, Hacker, Stefan2

Post Reply
helloiac
Junior Member
Junior Member
Posts: 4
Joined: 2018-05-03, 13:45 UTC

Lister detect files with no extension

Post by *helloiac »

Hi, I want to show makefile in cudalister, as you know, most makefiles have no extension, so I have no idea how to detect them and let cudalister capture the handle. I read about "ListGetDetectString" in the manual, and found no FILENAME like operands.
Please help, thanks!

Code: Select all

EXT The extension of the file to be loaded (always uppercase).
SIZE The size of the file to be loaded.
FORCE 1 if the user chose 'Image/Multimedia' from the menu, 0 otherwise.
MULTIMEDIA This detect string is special: It is always TRUE (also in older TC versions). If it is present in the string, this plugin overrides internal multimedia viewers in TC. If not, the internal viewers are used. Check the example below!
User avatar
elgonzo
Power Member
Power Member
Posts: 840
Joined: 2013-09-04, 14:07 UTC

Re: Lister detect files with no extension

Post by *elgonzo »

Do you want (or are okay with) to show any extension-less file in CudaLister?
Or do you want to NOT show extension-less files in CudaLister, except for makefiles?
Windows 7 Pro x64 SP1
helloiac
Junior Member
Junior Member
Posts: 4
Joined: 2018-05-03, 13:45 UTC

Re: Lister detect files with no extension

Post by *helloiac »

I want to know how to show any extension-less file in CudaLister, and for now, I want to show makefiles in CudaLister.

I know code below will detect "*.sh" files and bash files without ".sh" extension, and give control to cudalister:
<code>
6=%COMMANDER_PATH%\Plugins\wlx\cudalister\cudalister.wlx
6_detect=EXT="sh" | [0]="#" & [1]="!" & FINDI("#!/bin/bash")
</code>

but I don't know how to detect file "makefile" or "Makefile" because makefiles don't have specific file header and lister don't support FILENAME like operand.
User avatar
elgonzo
Power Member
Power Member
Posts: 840
Joined: 2013-09-04, 14:07 UTC

Re: Lister detect files with no extension

Post by *elgonzo »

Think of a file without extension as a file with an empty extension. Thus, try including EXT = "" in your detect string, something like this:

Code: Select all

6_detect="EXT="" | EXT="sh" | [0]="#" & [1]="!" & FINDI("#!/bin/bash")"
Windows 7 Pro x64 SP1
helloiac
Junior Member
Junior Member
Posts: 4
Joined: 2018-05-03, 13:45 UTC

Re: Lister detect files with no extension

Post by *helloiac »

This works, thank you!
If I want to NOT show extension-less files in CudaLister, except for makefiles, will be there a method to achive it?
User avatar
elgonzo
Power Member
Power Member
Posts: 840
Joined: 2013-09-04, 14:07 UTC

Re: Lister detect files with no extension

Post by *elgonzo »

helloiac wrote: 2021-02-26, 09:54 UTC If I want to NOT show extension-less files in CudaLister, except for makefiles, will be there a method to achive it?
I am not aware of some clever detect string hacks to make it match against file names. A quick forum search didn't reveal anything either, but maybe i missed something or chose unlucky search terms.

Unless someone else knows of such an undocumented hack, the only way i (theoretically) see with TC's current feature set would be a lister plug-in itself checking the file name in its ListLoad implementation. That could be an (custom) implementation in the desired lister plug-in itself, or a proxy lister plug-in wrapping other lister plug-ins (such as CudaLister). Unfortunately, i am not aware of any such proxy plug-ins, if they exist at all... :(
Windows 7 Pro x64 SP1
helloiac
Junior Member
Junior Member
Posts: 4
Joined: 2018-05-03, 13:45 UTC

Re: Lister detect files with no extension

Post by *helloiac »

Thanks for your help. I find EXT="" is goog enough to meet my need, most extension-less files are a kind of code, and CudaLiser show a better view than default lister, also I can change lexer from the status bar, images without extension can be handled properly by lister, not affeced by the EXT="" config.
Post Reply