Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-05

target filename extension

18 messages · 8 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Graeme Geldenhuys

Hi,

Where in Lazarus (or maybe even FPC) do I setup the target filename extension for each platform.

eg:
Without specifying anything, under Windows it's '.exe' Under Linux and FreeBSD it's nothing.

I'm getting annoyed not being able to easily search and delete any executables in my Linux programming folders. So from now onwards I would like all my Linux projects to actually have an extension. I'm thinking of following the Mac idea. Using '.app' as an extension. I don't want to use '.exe' because to me that denotes Windows applications and I want to easily distinguish between them.

I know I can change the target filename in 'Project Options', but then it's going to be the same for all platforms. I want it to be '.exe' for Windows and '.app' under Linux & FreeBSD.

I would also like it to be a default. I don't want to go to each project and change the Project Options. Is there something like that available? Even if I need to locally modify my Lazarus, I don't mind. Maybe this can even become a new Environment Option in Lazarus?

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Mattias Gaertner
to Graeme Geldenhuys
Show quoted text 11 lines
Hi, Where in Lazarus (or maybe even FPC) do I setup the target filename extension for each platform. eg: Without specifying anything, under Windows it's '.exe' Under Linux and FreeBSD it's nothing. I'm getting annoyed not being able to easily search and delete any executables in my Linux programming folders.

Here is a one liner:
find my-Linux-programming-folder -name '' -type f -perm /111 -regex '[^.]+' -exec rm {} \;

I'm curious:
Why don't you use an output directory? Then you can simple delete all files there.

So from now onwards I would like all my Linux projects to actually have an extension. I'm thinking of following the Mac idea. Using '.app' as an extension.

IMO .app is a bad idea, because: The .app is hidden in the finder, the executable itself has no extension and .app is meant to be the folder, not the executable.

I don't want to use '.exe' because to me that denotes Windows applications and I want to easily distinguish between them.

IMHO you should easily distinguish between Mac OS X applications folders and linux binaries too and not use .app.

Show quoted text 8 lines
I know I can change the target filename in 'Project Options', but then it's going to be the same for all platforms. I want it to be '.exe' for Windows and '.app' under Linux & FreeBSD. I would also like it to be a default. I don't want to go to each project and change the Project Options. Is there something like that available? Even if I need to locally modify my Lazarus, I don't mind. Maybe this can even become a new Environment Option in Lazarus?

There is no option yet. Here is the default:
ide/lazconf.pp GetExecutableExt

Mattias

Reply by email

Graeme Geldenhuys
to Mattias Gaertner
Mattias Gaertner wrote 6 lines
> I'm getting annoyed not being able to easily search and delete any > executables in my Linux programming folders. Here is a one liner: find my-Linux-programming-folder -name '' -type f -perm /111 -regex '[^.]+' -exec rm {} \;

Thanks, I'll make a note of that. But sometimes I use Midnight Commander or Total Commander via Wine, so in that case it doesn't work (or at least easily). I often use the search feature in Total Commander, feed the results to a Panel and delete everything it found.

I'm curious: Why don't you use an output directory? Then you can simple delete all files there.

I do, a 'units' directory. But that only stores the the *.o or *.ppu files. My executable get created in the same directory as the .lpr file. That's how I prefer it.

IMO .app is a bad idea, because: The .app is hidden in the finder, the executable itself has no extension and .app is meant to be the folder, not the executable.

My knowledge of Mac OS X equates to 2 hours of playing with it. I didn't know .app is a folder! I also don't develop application for a Mac yet, but will some day.

I simply thought '.app' is nice, because it = 'application' I did think of '.bin', but that = binary. Many other things are also binary files (shared objects, database files etc), so doesn't really say 'Hey I'm an application!' to me. ;-)

Any other suggestions for a linux application extension?

IMHO you should easily distinguish between Mac OS X applications folders and linux binaries too and not use .app.

True.

There is no option yet. Here is the default: ide/lazconf.pp GetExecutableExt

Thanks for pointing me in the right direction. I'll see if I can make some Environment Option.

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Mattias Gärtner
Mattias G?rtner wrote
> least easily). I often use the search feature in Total Commander, feed > the results to a Panel and delete everything it found. Can it search for files without extension?

If you put in * it should find them, but you can search for '*.ppu;*.o' and executables without extensions. The major issue is that Windows doesn't have a File Attribute = execute.

Well, apparently you prefer the 'file extension = file type' idea. You will hate Macs.

I like the idea of not using extensions, but then again, it makes life really hard. How do you know what file type you have when working from the command line in linux for example. That's why in Mac Finder and Windows Explorer I enable 'show file extensions'.

Example:

graemeg at graemeg:tmp$ ls -l untit*
-rw-r--r-- 1 graemeg graemeg 7280 2008-05-21 13:50 untitled1 -rw-r--r-- 1 graemeg graemeg 2311 2008-05-21 13:51 untitled2 -rw-r--r-- 1 graemeg graemeg 96256 2008-05-21 13:51 untitled3

Here it lists three files of different types. OpenDocument Text, Rich Text and MS Word respectively. You have no idea knowing that from the command line, other than using some hex editor to peak at the first 3-5 bytes of the file (a process way above the avg user).

As a test, I opened Nautilus. As with most Linux apps, it normally detects the file via it's magic number or something, not the file extension. The first two worked by simply double clicking on them, but it had no idea what 'untitled3' was (MS Word document). Strange!

Using file extensions simply gives you a nice fallback option (hint) as to what mime type it is.

Here is an interesting article (thoughts) from L505. The title 'The Stupidity of Files Without Extensions' says it all. ;-)

http://z505.com/cgi-bin/qkcont/qkcont.cgi?p=The%20Stupidity%20of%20Files%20Without%20Extensions

It is a secret and only told the most fearless Mac users (those using the terminal). ;)

So on a Mac, what's the different between a .app and .cmg (I think it was) files? Are they both folders? I had to unmount the .cmg file, so I take it, it's some kind of drive image file...

> Any other suggestions for a linux application extension? .linux or .elf

I like .elf! :-)

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Mattias Gaertner: On Wed, 21 May 2008 09:38:30 +0200 Here is a one liner: find my-Linux-programming-folder…
Mattias Gaertner wrote 6 lines
> I'm getting annoyed not being able to easily search and delete any > executables in my Linux programming folders. Here is a one liner: find my-Linux-programming-folder -name '' -type f -perm /111 -regex '[^.]+' -exec rm {} \;

I tried the following, and it didn't delete any of my executables. With or without file extensions.

find UnitTests -name '' -type f -perm /111 -regex '[^.]+' -exec rm {} \;

'UnitTests' is the folder I'm interested in and it contains sub folders with sub projects.

I'm running Linux (Ubuntu 7.10).

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Graeme Geldenhuys: If you put in * it should find them, but you can search for '*.ppu;*.o' and executables…
Graeme Geldenhuys wrote
As a test, I opened Nautilus. As with most Linux apps, it normally detects the file via it's magic number or something, not the file extension. The first two worked by simply double clicking on them, but it had no idea what 'untitled3' was (MS Word document). Strange!

Even more strange. I right click on 'untitled3' and say 'Open With' and select OpenOffice Writer and still it doesn't work. Changing the file to untiltle3.doc and it works perfectly. Possible bug in OO Writer???

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Henry Vermaak
to Graeme Geldenhuys: If you put in * it should find them, but you can search for '*.ppu;*.o' and executables…

2008/5/21 Graeme Geldenhuys :
-->8--

Show quoted text 5 lines
I like the idea of not using extensions, but then again, it makes life really hard. How do you know what file type you have when working from the command line in linux for example. That's why in Mac Finder and Windows Explorer I enable 'show file extensions'.

`man file` will tell you all about getting file types. extensions are meaningless, since anyone can change them, but they can make life easier.

henry

Reply by email

Marc Santhoff
to Graeme Geldenhuys: If you put in * it should find them, but you can search for '*.ppu;*.o' and executables…
Graeme Geldenhuys wrote 16 lines
Example: graemeg at graemeg:tmp$ ls -l untit* -rw-r--r-- 1 graemeg graemeg 7280 2008-05-21 13:50 untitled1 -rw-r--r-- 1 graemeg graemeg 2311 2008-05-21 13:51 untitled2 -rw-r--r-- 1 graemeg graemeg 96256 2008-05-21 13:51 untitled3 Here it lists three files of different types. OpenDocument Text, Rich Text and MS Word respectively. You have no idea knowing that from the command line, other than using some hex editor to peak at the first 3-5 bytes of the file (a process way above the avg user). As a test, I opened Nautilus. As with most Linux apps, it normally detects the file via it's magic number or something, not the file extension. The first two worked by simply double clicking on them, but it had no idea what 'untitled3' was (MS Word document). Strange!
$ file unti*

should do:

$ file *
Physik_Praktikum 6.xls: Microsoft Office Document Versuch 3a.doc: Microsoft Office Document Versuch 6a.doc: Microsoft Office Document Zugefestigkeit: directory
Zugversuch.pdf: PDF document, version 1.4

So file does know at least ms-word documents. I think

$ man file

or

$ man magic

wil tell a lot about it. MAc does have a BSD userland too and thus there is magic (=the database for detecting file types).

Using file extensions simply gives you a nice fallback option (hint) as to what mime type it is.

Connecting applications and MIME types is a different thing.

> .linux or .elf I like .elf! :-)
$ file enum
enum: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), statically linked, stripped

Hmmmm... ;)

Marc

Reply by email

Micha Nelissen
to Graeme Geldenhuys: I tried the following, and it didn't delete any of my executables. With or without file…
Graeme Geldenhuys wrote 11 lines
Mattias Gaertner wrote: >> I'm getting annoyed not being able to easily search and delete any >> executables in my Linux programming folders. > Here is a one liner: > find my-Linux-programming-folder -name '' -type f -perm /111 -regex > '[^.]+' -exec rm {} \; I tried the following, and it didn't delete any of my executables. With or without file extensions. find UnitTests -name '' -type f -perm /111 -regex '[^.]+' -exec rm {} \;

Escape the '{}':

... rm \{\} \;

Remove the -name; don't know what that should do.

Perhaps wise to use 'echo' first, to see what you're going to delete ;-).

Micha

Reply by email

Graeme Geldenhuys
to Marc Santhoff: $ file unti* should do: $ file * Physik_Praktikum 6.xls: Microsoft Office Document…
Marc Santhoff wrote 9 lines
$ file * Physik_Praktikum 6.xls: Microsoft Office Document Versuch 3a.doc: Microsoft Office Document Versuch 6a.doc: Microsoft Office Document Zugefestigkeit: directory Zugversuch.pdf: PDF document, version 1.4 So file does know at least ms-word documents. I think

Before this message thread I never knew about the 'file' command.

graemeg at graemeg:tmp$ file unt*
untitled1: data
untitled2: Rich Text Format data, version 1, ANSI
untitled3: Microsoft Office Document

From it's output, it seems to know 'untitled3' is a MS Word document, yet Nautilus cannot open it when I double click on it. Clearly some bug in Nautilus or some system specific setup issue on my system.

Bottom line is that file extensions have a use. They simply make things easier, although they are not perfect.

Show quoted text 7 lines
>> .linux or .elf > I like .elf! :-) $ file enum enum: ELF 32-bit LSB executable, Intel 80386, version 1 (FreeBSD), statically linked, stripped Hmmmm... ;)

Open Source software - one can never win! ;) On my system...

graemeg at graemeg:textwidth$ file textwidth.elf
textwidth.elf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped

Even though the system could be FreeBSD or Linux, .elf is a good enough extension for my executables. '*.elf-linux' is just to long. My copy of Lazarus by default now generates '*.elf' named executables under Linux. :-)

Now I just need to figure out how to convince FPC to do it by default from the command line.

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Graeme Geldenhuys
to Micha Nelissen: Escape the '{}': ... rm \{\} \; Remove the -name; don't know what that should do. Perhaps…
Micha Nelissen wrote 10 lines
> > find UnitTests -name '' -type f -perm /111 -regex '[^.]+' -exec rm {} \; Escape the '{}': ... rm \{\} \; Remove the -name; don't know what that should do. Perhaps wise to use 'echo' first, to see what you're going to delete ;-).

Good idea! :-)

Escaping didn't work. I had to remove the -regex command, then things started to go my way.

eg:
   find UnitTests -type f -perm /111 -exec echo {} \;

It now listed all executable files... :-)
Reading through the 'find' man page, it's damn impressive what the find command can do. A real hidden treasure.

BTW:
I found that Midnight Commander has an extended search feature where you and feed in commands like 'find' and it will panelize the output. You can find the option under 'Command | External panelize'. After using Linux for 10 years, I'm still learning new tricks. Awesome!

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Damien Gerard
to Graeme Geldenhuys

Le May 22, 2008 ? 10:01 AM, Graeme Geldenhuys a ?crit :

Show quoted text 22 lines
Micha Nelissen wrote: >> >> find UnitTests -name '' -type f -perm /111 -regex '[^.]+' -exec rm >> {} \; > > Escape the '{}': > > ... rm \{\} \; > > Remove the -name; don't know what that should do. > > Perhaps wise to use 'echo' first, to see what you're going to > delete ;-). Good idea! :-) Escaping didn't work. I had to remove the -regex command, then things started to go my way. eg: find UnitTests -type f -perm /111 -exec echo {} \;

if UnitTests is the name of your files you may use -iname :

find -iname 'Unittests' -type f -perm /111 -exec echo '{}' \;
Show quoted text 5 lines
It now listed all executable files... :-) Reading through the 'find' man page, it's damn impressive what the find command can do. A real hidden treasure.

find as many others command-line unix program are real treasures :)

Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat

Reply by email

Mattias Gaertner
to Graeme Geldenhuys: I tried the following, and it didn't delete any of my executables. With or without file…
Show quoted text 13 lines
Mattias Gaertner wrote: >> I'm getting annoyed not being able to easily search and delete any >> executables in my Linux programming folders. > > Here is a one liner: > find my-Linux-programming-folder -name '' -type f -perm /111 -regex > '[^.]+' -exec rm {} \; I tried the following, and it didn't delete any of my executables. With or without file extensions. find UnitTests -name '' -type f -perm /111 -regex '[^.]+' -exec rm {} \;

Sorry. Remove the -name ''. It was a copy/paste bug.

'UnitTests' is the folder I'm interested in and it contains sub folders with sub projects. I'm running Linux (Ubuntu 7.10).

Mattias

Reply by email

Marco van de Voort
to Graeme Geldenhuys: If you put in * it should find them, but you can search for '*.ppu;*.o' and executables…
Graeme Geldenhuys wrote 8 lines
graemeg at graemeg:tmp$ ls -l untit* -rw-r--r-- 1 graemeg graemeg 7280 2008-05-21 13:50 untitled1 -rw-r--r-- 1 graemeg graemeg 2311 2008-05-21 13:51 untitled2 -rw-r--r-- 1 graemeg graemeg 96256 2008-05-21 13:51 untitled3 Here it lists three files of different types. OpenDocument Text, Rich Text and MS Word respectively.

How do you know that on windows? Richt text e.g. is some times also .doc.

On Windows people often confuse file type with extension. (and lots of security problems were the result).

On unix it is a bit simpler:

ls untitled* |xargs -Iplaceholder file placeholder

You have no idea knowing that from the command line, other than using some hex editor to peak at the first 3-5 bytes of the file (a process way above the avg user).

See above, it is way better.

Reply by email

Marco van de Voort
to Graeme Geldenhuys: Before this message thread I never knew about the 'file' command. graemeg at graemeg:tmp$…
Graeme Geldenhuys wrote 15 lines
Marc Santhoff wrote: > Zugversuch.pdf: PDF document, version 1.4 > > So file does know at least ms-word documents. I think Before this message thread I never knew about the 'file' command. graemeg at graemeg:tmp$ file unt* untitled1: data untitled2: Rich Text Format data, version 1, ANSI untitled3: Microsoft Office Document From it's output, it seems to know 'untitled3' is a MS Word document, yet Nautilus cannot open it when I double click on it. Clearly some bug in Nautilus or some system specific setup issue on my system.

I think the fact that there is no version specified for the office document says enough. The detection is superficial.

Bottom line is that file extensions have a use. They simply make things easier, although they are not perfect.

One can discus about that. One can also discuss about what they should have done back then.

However IMHO it is not worth going against convention here.

Show quoted text 10 lines
graemeg at graemeg:textwidth$ file textwidth.elf textwidth.elf: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped Even though the system could be FreeBSD or Linux, .elf is a good enough extension for my executables. '*.elf-linux' is just to long. My copy of Lazarus by default now generates '*.elf' named executables under Linux. :-) Now I just need to figure out how to convince FPC to do it by default from the command line.

Edit compiler/systems/i_linux

Reply by email

Graeme Geldenhuys
to Mattias Gaertner: On Wed, 21 May 2008 09:38:30 +0200 Here is a one liner: find my-Linux-programming-folder…
Mattias Gaertner wrote
Here is a one liner: find my-Linux-programming-folder -name '' -type f -perm /111 -regex '[^.]+' -exec rm {} \;

Just to recap. Your -regex part did not work on my Ubuntu Linux system.

I had to change:

find . -type f -perm /111 -regex '[^.]+' -print

... to ....

find . -type f -perm /111 \( ! -regex '.*/\..*' \) -print

Now it finds all executables excluding and hidden directories and files in the results. Even excluding non-hidden files in hidden directories (which is what I want).

Regards,
- Graeme -

_______________________________________________________ fpGUI - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/

Reply by email

Marco van de Voort
to Graeme Geldenhuys
Graeme Geldenhuys wrote
Just to recap. Your -regex part did not work on my Ubuntu Linux system.

(btw Neither did they in my freebsd system. (without regex), I had to change the slash of /111 into a minus (-111) )

Reply by email