Recent

Author Topic: Rename files in project to lowercase  (Read 1281 times)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Rename files in project to lowercase
« on: July 06, 2024, 10:59:27 am »
Regarding issue :
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/10370
It is now implemented in the Project menu.
Please test.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

bobby100

  • Sr. Member
  • ****
  • Posts: 260
    • Malzilla
Re: Rename files in project to lowercase
« Reply #1 on: July 06, 2024, 06:33:54 pm »
I don't like it when Lazarus renames my files to lowercase. Is there an option to turn this off generally?

WooBean

  • Sr. Member
  • ****
  • Posts: 277
Re: Rename files in project to lowercase
« Reply #2 on: July 06, 2024, 07:29:37 pm »
I don't like it when Lazarus renames my files to lowercase. Is there an option to turn this off generally?
Yes, there is such setting for saving files - see Tools/Options/IDE Options/Environment/Naming.
Some IDE features may not respect that setting.

Keeping unit or project file names in lowercase is a reasonable strategy - it allows bidirectional porting Lazarus projects from  operational systems where file systems are case insensitive to systems where it is opposite.

Nobody is forced to follow this way.
« Last Edit: July 06, 2024, 07:39:30 pm by WooBean »
Platforms: Win7/64, Linux Mint Ulyssa/64

bobby100

  • Sr. Member
  • ****
  • Posts: 260
    • Malzilla
Re: Rename files in project to lowercase
« Reply #3 on: July 06, 2024, 08:59:42 pm »
I do not see where is a problem with porting if the files are with mixed-case naming?

See one of my projects here: https://github.com/BobanSpasic/MiniDexedLibrarian
If you take a look in the src or units directory, the files are mixed case, and it is compiling just fine on Windows/Linux/FreeBSD/OSX
Apart from renaming the files back to the mixed-case (after Lazarus renames everything to lowercase), one also need to edit the .lpi file to match the file names, because there is also everything lowercase.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4541
  • I like bugs.
Re: Rename files in project to lowercase
« Reply #4 on: July 07, 2024, 05:18:53 am »
I do not see where is a problem with porting if the files are with mixed-case naming?
There is no problem when a mixed case unit name matches exactly with the mixed case filename everywhere.
Problems come when unit names are spelled a little differently somewhere. Pascal language is case insensitive. Lowercasing filenames is a strategy to allow different Pascal spellings.
I have seen the problem many times in example projects sent by windows users. I must fix char case before it runs on Linux.
The new menu item is especially useful with Delphi projects ported to Lazarus. It can save lots of manual editing. Yes, the Delphi converter should have an option for it, too.

Quote
Apart from renaming the files back to the mixed-case (after Lazarus renames everything to lowercase), one also need to edit the .lpi file to match the file names, because there is also everything lowercase.
The settings mentioned by WooBean seem to work fine. Just turn off lowercasing and you are good to go.
If you find a bug there,  please report.
« Last Edit: July 07, 2024, 05:30:37 am by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

bobby100

  • Sr. Member
  • ****
  • Posts: 260
    • Malzilla
Re: Rename files in project to lowercase
« Reply #5 on: July 07, 2024, 08:21:55 am »
Thanks to both of you for taking your time.

I wasn't aware of the settings mentioned by WooBean, and now I feel bad about complaining.

Yesterday I was more in the mood "if one does it wrong, it is his own fault", but I understand your point.

 

TinyPortal © 2005-2018