Recent

Author Topic: Project templates — problem with subfolders  (Read 535 times)

bibsi

  • Newbie
  • Posts: 2
Project templates — problem with subfolders
« on: March 28, 2026, 12:10:04 pm »
Hi :-)
I’m working on a BasicApp, basically an application that provides the basics for a database
application.
Now I’d like to turn the current state into a template.
What I’ve done so far:
In Lazarus > Tools > Project Templates Settings, I created the default path:
Code: Pascal  [Select][+][-]
  1. /home/lcb/bin/lazarus_fixes/config_lazarus/templates
I then saved my project using Project > Publish Project into this folder:
Code: Pascal  [Select][+][-]
  1. /home/lcb/bin/lazarus_fixes/config_lazarus/tem plates/basicapp
After that, I created a text file in that folder called project.ini with the following content:
Code: Pascal  [Select][+][-]
  1. [Variables]
  2. [Project]
  3. name=BasicApp
  4. Recurse=1
After restarting Lazarus, I found a new entry under File called New Project from Template, and
my template was indeed listed there.
But I was a bit too early to celebrate.
The Recurse=1 entry does not do what I expected.
As I understand it, it should create the subfolders of my template and copy the files contained
in them.
Instead, I get the following error from Lazarus:
Code: Pascal  [Select][+][-]
  1. Cannot find com ponent class "TFrame1".
  2. It is not registered with RegisterClass and no .lfm file was found.
  3. It is required by unit:
  4. /home/lcb/lzProject/003.test/mainunit.pas
This happens because the subfolders are not created and the required files are missing.

Do you have any advice on how I can solve this?

Best regards,
Bibsi

Quote
I don't speak English, it's a translation. Sorry.
« Last Edit: March 28, 2026, 12:26:21 pm by bibsi »

n7800

  • Hero Member
  • *****
  • Posts: 672
  • Lazarus IDE contributor
    • GitLab profile
Re: Project templates — problem with subfolders
« Reply #1 on: March 30, 2026, 07:11:23 pm »
Thanks for reporting this. It turned out to be a bug in the package code, and I've already proposed a fix, which might be included in Lazarus 5.0.

n7800

  • Hero Member
  • *****
  • Posts: 672
  • Lazarus IDE contributor
    • GitLab profile
Re: Project templates — problem with subfolders
« Reply #2 on: March 30, 2026, 07:11:59 pm »
If you'd like, you can also make a fix to your IDE's code. In the "components\projecttemplates\projecttemplates.pp" file, there are two "if Recurse then" checks, and below them, a call to FindFirstUTF8:
* Replace the second argument from "0" with "faDirectory".
* In the second case, replace the comparison "<>0" with "=0".

After that, rebuild the IDE using "Menu > Tools > Build Lazarus".

Or simply apply the patch, if that's more convenient for you.

bibsi

  • Newbie
  • Posts: 2
Re: Project templates — problem with subfolders
« Reply #3 on: March 31, 2026, 11:13:36 am »
Thanks for your help, it worked.

 :)  :D

 

TinyPortal © 2005-2018