Re: [Lazarus] Package filenames with _package

2018-01-10 Thread Kostas Michalopoulos via Lazarus
On Mon, Jan 8, 2018 at 11:38 PM, Graeme Geldenhuys via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:

> Then it seems Windows Explorer is right up your alley. :) They hide the
file extension by default. Users (like me) have to explicitly go into the
settings and enable "show file extensions" option.

I do the same as i dislike having the extensions hidden. I want them to be
short, not hidden. Also you see file lists in more places than a file
manager - a common one being version control programs.

> Even better, Linux and FreeBSD don't even need file extensions. File
Extensions are simply for [some] human benefit (unlike Windows that
requires them). Linux and FreeBSD OS's query the first 4-8 bytes of a file
to accurately determine the file type and use the appropriate application
to open them.

Not really. Linux, FreeBSD or any other Unix OS have no idea about file
types beyond executable files (and that is set via the executable bit).
Application association is something desktop environments concern
themselves with. KDE and GNOME back in the 90s decided to use MIME types
together with an association database based on globs and eventually they
decided to create a common database through the freedesktop.org project.
Today most (but not all) desktop environments tend to simply use this
shared database which does the association from file to MIME type using
several approaches, including globs and magic byte sniffing, depending on
each type. In fact the recommended approach is to first match by glob and
if that fails or produces conflicting results (e.g. two types claim a
single file) only then to try to check the file's contents.

You can read the full spec here:
https://specifications.freedesktop.org/shared-mime-info-spec/0.18/ar01s02.html#idm139750558222816

Although note that this is just a convention and not a standard
(freedesktop is not a standards body, it just happens to be popular enough
due to being made by KDE and GNOME during their most popular days) - other
desktop environments or programs do their own thing and more often than not
this thing is based on pattern matching filenames for their extensions. It
makes sense after all since opening a file to read its contents would be
much slower - especially when done through network filesystems - than
simply checking the filename, which is why the content checking part is
used as a fallback instead of the primary way to determine the file
contents (some file managers even ignore the magic part if they are
browsing a network FS). And magic data do not really help with multipurpose
file formats like containers - how are you going to tell the difference
between a Java JAR, Java WAR and a LibreOffice ODT file when all are ZIP
files? - or text files like JSON, Plist, INI and several others that are
used for special purpose storage. Hell, you don't even need to look much
further than Lazarus here: packages, projects and session files (and
perhaps other stuff) are simple XML files and all of them even have the
same root node and no namespace configuration, so you cannot really
separate them from each other from anything else than the extension.

This "extension isn't a unix thing" wasn't even true in the days of the
original Unix - extensions were used all over the place there too as they
often were useful for shell scripts. The only system (that i know of) that
really didn't need extensions was the classic MacOS which simply stored the
file type as metadata and used that to decide what to do with the file.
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-08 Thread wkitty42--- via Lazarus

On 01/08/2018 04:38 PM, Graeme Geldenhuys via Lazarus wrote:
Even better, Linux and FreeBSD don't even need file extensions. File Extensions 
are simply for [some] human benefit (unlike Windows that requires them). Linux 
and FreeBSD OS's query the first 4-8 bytes of a file to accurately determine the 
file type and use the appropriate application to open them.



yup! i have a ton-load of scripts in perl, python, python3, bash, and just plain 
commands as if i were to type them manually... none of them have extensions on 
them... i don't even know what they are written in unless i go into them with an 
editor to modify them for some reason ;)



--
 NOTE: No off-list assistance is given without prior approval.
   *Please keep mailing list traffic on the list unless*
   *a signed and pre-paid contract is in effect with us.*
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-08 Thread Graeme Geldenhuys via Lazarus

On 2018-01-08 21:30, Kostas Michalopoulos via Lazarus wrote:

some cases it takes space (like in file managers). Up to 4 letters is fine
for me, 5 is stretching it and anything above that is only something i'd
use for file types that i wont see often in a list and even then only if i
can't avoid it (but really even just 4 characters gives you a lot of
variation).


Then it seems Windows Explorer is right up your alley. :) They hide the 
file extension by default. Users (like me) have to explicitly go into 
the settings and enable "show file extensions" option.


Even better, Linux and FreeBSD don't even need file extensions. File 
Extensions are simply for [some] human benefit (unlike Windows that 
requires them). Linux and FreeBSD OS's query the first 4-8 bytes of a 
file to accurately determine the file type and use the appropriate 
application to open them.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-08 Thread Kostas Michalopoulos via Lazarus
On Sun, Jan 7, 2018 at 1:06 PM, Graeme Geldenhuys via Lazarus <
lazarus@lists.lazarus-ide.org> wrote:
> so why is everybody still limiting file extensions to 3 letters?? Some of
my fpGUI included applications use file extensions like *.project etc.
Hell, even Microsoft is catching up with that idea (although minor) and now
use 4 letter extensions like *.docx etc.

One reason is simply habit, but also because these extensions are visible
to the user more often than not and having long extensions in filename
lists (like, e.g, when using version control) become redundant noise and in
some cases it takes space (like in file managers). Up to 4 letters is fine
for me, 5 is stretching it and anything above that is only something i'd
use for file types that i wont see often in a list and even then only if i
can't avoid it (but really even just 4 characters gives you a lot of
variation).
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Mattias Gaertner via Lazarus
On Sun, 07 Jan 2018 15:02:18 +0100
Vojtěch Čihák via Lazarus  wrote:

> I noticed: if the main package file has the same name as the lpk than it is 
> not listed in that lpk, right?

Correct.
Not every package needs such a file.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Vojtěch Čihák via Lazarus

I noticed: if the main package file has the same name as the lpk than it is not 
listed in that lpk, right?
V.
__

Od: Mattias Gaertner via Lazarus <lazarus@lists.lazarus-ide.org>
Komu: lazarus@lists.lazarus-ide.org
Datum: 07.01.2018 14:55
Předmět: Re: [Lazarus] Package filenames with _package


On Sun, 7 Jan 2018 20:08:31 +0700
Ondrej Pokorny via Lazarus <lazarus@lists.lazarus-ide.org> wrote:

>[...]
> >> The package unit can have a different name as the package. See
> >> for example synedit.  
> >
> > I didn't know this, and this is good to know !  
> 
> I didn't know this either. Where can the pas file name be changed? I 
> can't find any entry in the Package Options dialog.


Right click on an unit in the package editor and set File Type to "Main
Unit". That is then the auto generated unit.

Here is how to create a new package with this:
http://wiki.freepascal.org/Lazarus_Packages#Create_a_package_with_a_unit_that_has_the_same_name_as_the_package
 
<http://wiki.freepascal.org/Lazarus_Packages#Create_a_package_with_a_unit_that_has_the_same_name_as_the_package>

If you often need to create packages a custom main unit name, feel free
to create a new package type or an initial setup dialog.


Mattias
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus 
<https://lists.lazarus-ide.org/listinfo/lazarus>

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Mattias Gaertner via Lazarus
On Sun, 7 Jan 2018 20:08:31 +0700
Ondrej Pokorny via Lazarus  wrote:

>[...]
> >> The package unit can have a different name as the package. See
> >> for example synedit.  
> >
> > I didn't know this, and this is good to know !  
> 
> I didn't know this either. Where can the pas file name be changed? I 
> can't find any entry in the Package Options dialog.

Right click on an unit in the package editor and set File Type to "Main
Unit". That is then the auto generated unit.

Here is how to create a new package with this:
http://wiki.freepascal.org/Lazarus_Packages#Create_a_package_with_a_unit_that_has_the_same_name_as_the_package

If you often need to create packages a custom main unit name, feel free
to create a new package type or an initial setup dialog.


Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Martin Frb via Lazarus

On 07/01/18 14:35, Ondrej Pokorny via Lazarus wrote:

On 07.01.2018 20:29, Vojtěch Čihák via Lazarus wrote:


Hi,

click Package->New Package...

it immediately opens Save dialog, where you choose filname. It saves 
xyz.lpk


Then click Compile and xyz.pas is autogenerated.



:D

The question was: it saves xyz.lpk, where can I define that abc.pas is 
autogenerated/used for xyz.lpk instead of xyz.pas?


I think, add a unit, select it in the list, right click it, and in "file 
type" make it the "main unit"


Maybe there is an easier way

SynEditDsgn has this

the auto generated unit is allsyneditdsgn.pas

and the unit with registration is "syneditlazdsgn.pas" (see checkbox at 
the bottom of package dialog.

So this as afaik why the unit will be called from the autogenerated unit.

-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Ondrej Pokorny via Lazarus

On 07.01.2018 20:29, Vojtěch Čihák via Lazarus wrote:


Hi,

click Package->New Package...

it immediately opens Save dialog, where you choose filname. It saves 
xyz.lpk


Then click Compile and xyz.pas is autogenerated.



:D

The question was: it saves xyz.lpk, where can I define that abc.pas is 
autogenerated/used for xyz.lpk instead of xyz.pas?


Ondrej
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Michael Van Canneyt via Lazarus



On Sun, 7 Jan 2018, Mattias Gaertner via Lazarus wrote:


On Sun, 7 Jan 2018 10:42:33 +0100 (CET)
Michael Van Canneyt via Lazarus  wrote:


[...]
The "problem" is that the pascal unit generated for a package has the
same name as the package and often conflicts with a unit in the package. 


The package unit can have a different name as the package. See
for example synedit.


I didn't know this, and this is good to know !

Should not the IDE do this automatically by default then ?

Michael.
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Graeme Geldenhuys via Lazarus

On 2018-01-07 09:42, Michael Van Canneyt via Lazarus wrote:

many Laz packages have suffix anyway: Dsgn, Pkg, pkg, maybe others.

True. And this is unfortunate, because it is not functional at all.


Well, I think it is very important to distinguish between "runtime" and 
"design time" packages. One has very different dependencies and meaning 
compared to the other one.


Your idea of fpmake using automatic prefixes is good and all, but when a 
developer creates a package using Lazarus IDE, there is no "automatic 
naming" in play.


The "pkg" suffix is pointless indeed, that is what the file extension is 
for. But the "dsgn" suffix is commonly used to distinguish between 
runtime (no suffix) and design time usage.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Graeme Geldenhuys via Lazarus

On 2018-01-07 08:35, leledumbo via Lazarus wrote:

I don't agree, that's what file extension is for.


Fully agree.

I feel I should also add that DOS is not the mainstream OS any more like
it was in the early 90's (some 26 years ago), so why is everybody still 
limiting file extensions to 3 letters?? Some of my fpGUI included 
applications use file extensions like *.project etc. Hell, even 
Microsoft is catching up with that idea (although minor) and now use 4 
letter extensions like *.docx etc.


Regards,
  Graeme

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Mattias Gaertner via Lazarus
On Sun, 7 Jan 2018 10:42:33 +0100 (CET)
Michael Van Canneyt via Lazarus  wrote:

>[...]
> The "problem" is that the pascal unit generated for a package has the
> same name as the package and often conflicts with a unit in the package. 

The package unit can have a different name as the package. See
for example synedit.

Mattias
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread AlexeyT via Lazarus


conflicts with a unit in the package. IMO it would be better to prefix 
it automatically.
I agree: better to auto add prefix or suffix (i like suffix _package). 
good wish.


--
Regards,
Alexey

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Werner Pamler via Lazarus

Am 05.01.2018 um 18:12 schrieb AlexeyT via Lazarus:


 1. packager/globallinks/lclextensions_package-0.6.1.lpl



 2. +1 −0


packager/globallinks/virtualtreeview_package-5.5.3.1.lpl




(trunk)

It is good filenames, with _package suffix, easy to see filenames from 
all filenames in big dir. AT* packages also use this suffix. i suggest 
to add this suffix to ALL default packages




Again, we had this already in a similar context, but now it will break 
EVERY project out there.


-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Michael Van Canneyt via Lazarus



On Sun, 7 Jan 2018, AlexeyT via Lazarus wrote:



I am glad to read this, I also think the _package is completely 
redundant.


many Laz packages have suffix anyway: Dsgn, Pkg, pkg, maybe others.


True. And this is unfortunate, because it is not functional at all.

The "problem" is that the pascal unit generated for a package has the
same name as the package and often conflicts with a unit in the package. 
IMO it would be better to prefix it automatically.  (fpmake does this when

it makes a build unit)

MyPackage.lpk -> build_Mypackage.pas
or maybe
MyPackage.lpk -> run_Mypackage.pas
MyPackage.lpk -> ide_Mypackage.pas
Depending on what you chose for package options.

That way you would not need to prefix your package name with anything, 
unless you split your package in a design and runtime package. In the latter

case the prefix (or suffix) is still functional: it tells you that it is run
or design...

Michael.
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread AlexeyT via Lazarus


I am glad to read this, I also think the _package is completely 
redundant.


many Laz packages have suffix anyway: Dsgn, Pkg, pkg, maybe others.

--
Regards,
Alexey

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread AlexeyT via Lazarus



I don't agree, that's what file extension is for. Filtering and sorting
should easily be done to distinguish package files from others.


There is one moment: ATSynedit has

- atsynedit.pas (main unit)

- atsynedit_package.pas (with suffix)

You see suffix is useful here.

--
Regards,
Alexey

--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread Michael Van Canneyt via Lazarus



On Sun, 7 Jan 2018, leledumbo via Lazarus wrote:


It is good filenames, with _package suffix, easy to see filenames from all

filenames in big dir

I don't agree, that's what file extension is for. Filtering and sorting
should easily be done to distinguish package files from others.


I am glad to read this, I also think the _package is completely redundant.

Michael.
--
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Package filenames with _package

2018-01-07 Thread leledumbo via Lazarus
> It is good filenames, with _package suffix, easy to see filenames from all
filenames in big dir

I don't agree, that's what file extension is for. Filtering and sorting
should easily be done to distinguish package files from others.




--
Sent from: http://free-pascal-lazarus.989080.n3.nabble.com/
-- 
___
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus