* * *

Author Topic: save directory  (Read 309 times)

verstapp

  • Newbie
  • Posts: 3
save directory
« on: April 12, 2017, 10:35:32 am »
i remember in delphi [6, win] there was an option [default?] that all generated files for a project ended up in the directory where the source [.pas, .dfm, .dpr, etc] files lived. this was lovely for me.
lazarus doesn't appear to have this option, or if it does i haven't found it yet. ide options has a 'directory for building test projects' path, but changing it doesn't appear to change anything.
i also found project/options/paths but changing the unit output path didn't change where the executable ended up [in C:\Lazarus].
any ideas?

bote to forum maintainer - when i clicked in the password box when logging on after registering, my up-to-date copy of firefox [52.0.2, 32 bit] complained that this was an insecure site and that my credentials might be stolen. just so's you know..

wp

  • Hero Member
  • *****
  • Posts: 3336
Re: save directory
« Reply #1 on: April 12, 2017, 10:49:13 am »
If you clear the "Unit output directory" in the project's Compiler Options / Paths the compiler writes everything into the folder of the corresponding source file. I would not recommend this, however, because it makes it unnecessarily hard to remove compiler-generated files from your own code files and you cannot separate platform files.
« Last Edit: April 12, 2017, 10:56:03 am by wp »
Lazarus trunk / fpc 3.0.0 / Win32

verstapp

  • Newbie
  • Posts: 3
Re: save directory
« Reply #2 on: April 12, 2017, 11:40:27 am »
thanks, wp. i tried it anyway, .exe still ends up in c:\lazarus.
« Last Edit: April 12, 2017, 11:44:44 am by verstapp »

wp

  • Hero Member
  • *****
  • Posts: 3336
Re: save directory
« Reply #3 on: April 12, 2017, 12:47:48 pm »
The exe is put into the folder specified in "Target file name". Normally this is only the project name, without extension and without prepended path - the latter makes the binary go into the folder of the lpi file.

Is there an path in front of the project name in your case? Or maybe ($LazarusDir)?

Remarks
  • I often put here bin/$(TargetCPU)-$(TargetOS)/projectname to separate platforms.
  • And: don't add ".exe" to the Target file name, it will be added automatically in Windows, but not on Linux where the extension is not used.
Lazarus trunk / fpc 3.0.0 / Win32

verstapp

  • Newbie
  • Posts: 3
Re: save directory
« Reply #4 on: April 12, 2017, 01:16:12 pm »
Target file name is
project1
lazarus is still putting .exe, .compiled, .ico, .lpi, .lpr, .lps, .o, .obj and .res in c:\lazarus.

but then having closed/restarted lazarus a couple of times, and then created a new project in another folder, all of a sudden everything was saved to the [correct] directory, project2. sometimes 'have you tried turning it off and then on again?' does work. thanks again, wp.
« Last Edit: April 12, 2017, 01:44:39 pm by verstapp »

wp

  • Hero Member
  • *****
  • Posts: 3336
Re: save directory
« Reply #5 on: April 12, 2017, 02:45:46 pm »
Strange. This should not happen... Please come back if, by chance, you might find a way how to reproduce this false behavior.
Lazarus trunk / fpc 3.0.0 / Win32

molly

  • Hero Member
  • *****
  • Posts: 1474
Re: save directory
« Reply #6 on: April 12, 2017, 02:51:13 pm »
@wp,

afaik (and in case still present then) sometimes project settings changes are not (noted and) saved in project options.

Using resources in project options is also such a option that does not always get noticed by IDE. You can fix that by changing one of the check-boxes in your project options and set it directly back again, then especially do a save project. Note that the asterisk that indicates a change in the project must be present before saving, otherwise the changes will not be saved in project options.

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus