Sign in Join

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

Mailing lists / lazarus / 2025-01

Invalid project filename for project filenames containing a dash

4 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Noel Duffy

Lazarus 3.6 on MacOS behaves strangely when attempting to save a project filename that contains a dash (-). It produces the error message:

Invalid project filename
"/Users/noelduffy/tmp/a-b.lpi" is an invalid project name. Please choose another (e.g. project1.lpi)?

If the dash is removed, Lazarus saves the project filename. But why does it reject filenames with a dash in them? The dash is a perfectly valid character for a filename on MacOS, Linux and other Unixes, and Windows.

I tested this on Fedora 40 running Lazarus 3.6 too, and it does the same thing there. That is, it rejects a project filename if there?s a dash in it.

Reply by email

Bart
to Noel Duffy
Lazarus 3.6 on MacOS behaves strangely when attempting to save a project filename that contains a dash (-). It produces the error message:

..

If the dash is removed, Lazarus saves the project filename. But why does it reject filenames with a dash in them? The dash is a perfectly valid character for a filename on MacOS, Linux and other Unixes, and Windows.

Some identifier with a '-' in it, is NOT a valid Pascal identifier (see: IsValidIdent function in sysutils unit)
E.g. you cannot name a variable like this:
var
a-b: integer;

Unit names (and a such program names) must be valid identifiers.

This is Delphi compatible.

Bart

Reply by email

Mattias Gaertner
to Bart: On Wed, Jan 1, 2025 at 11:37?PM Noel Duffy via lazarus .. Some identifier with a '-' in…
Bart wrote
On Wed, Jan 1, 2025 at 11:37?PM Noel Duffy via lazarus wrote: [...] Unit names (and a such program names) must be valid identifiers.

Only unit names must be valid identifiers.
Program filenames can be any filename and their source name don't need to correspond. The program source name must be a valid identifier. This is for example useful for instantfpc programs.

Mattias

Reply by email