Forum > General
Huge problem with open files?
Madoc:
So, I just started trying to port a very large Delphi project to Lazarus, it's my first time really using it, and I'm running into some very serious problems with file versions and open files in general. I don't know if there's some way to modify this behaviour, but these are the issues I'm having:
1) For some reason it's sometimes opening unit files in the editor that are in a different folder from the project, instead of the ones in the project folder.
2) If I overwrite a unit file, and try to compile, Lazarus will somehow open the previous version of the file which no longer exists.
3) If I delete or rename a file, Lazarus will just re-create it, including all of its previous contents.
4) Closing a file in the editor doesn't actually seem to close it. If I save all it will save files that are no longer open, with whatever contents were in the editor last.
5) When I opened a file with the same name as one in the project from another folder for reference, then closed it and later saved all, it overwrote my other file with the contents of its own copy. This actually lost me lots of code.
It seems to me that the basic problem is that Lazarus keeps memory copies of recently opened files and will even overwrite those files once they have been "closed". Worse still, it gets confused about file locations, and loads and saves files in different locations with contents of other similarly named files.
This seems extremely problematic to me, and I'm now terrified that my code will be modified in unexpected ways or lost. Even just the ability to close a file therefore discarding any changes seems very important.
MarkMLl:
What you're describing is totally crazy. I'm reluctant to get involved since I'm not an "IDE innards" specialist, but I feel that somebody needs to jump in fast before you conclude that Lazarus is unusable.
There is definitely no in-memory caching. What your OS (and potentially any VCS etc.) is doing is something else entirely.
First, the obvious questions (frankly, you should have provided this info):
What version of Lazarus? What OS? Do you have multiple IDEs active at the same time?
Now, the non-obvious one:
Does whatever OS you're using have any form of symbolic link facility, and are any of your unit files accessed via something like that?
MarkMLl
Handoko:
@Madoc
Maybe not related, but I ever had problem using Lazarus with different versions of the pas file, which are from different locations.
You can try to quit the Lazarus and rename the folder. By doing so, Lazarus will 'forget' the project files' locations.
And I learn from my experience, now if I am using Lazarus and want to open other pas files to copy/pas some code, I use Pluma (Linux version for Notepad).
--- Quote from: Madoc on November 24, 2023, 12:38:55 pm ---4) Closing a file in the editor doesn't actually seem to close it.
--- End quote ---
I agree it is a bit weird. You can't close a file or project by doing File > Close (Page/All). If I really want to close it, I do: File > New > Project: Application.
--- Quote from: Madoc on November 24, 2023, 12:38:55 pm ---5) When I opened a file with the same name as one in the project from another folder for reference, then closed it and later saved all, it overwrote my other file with the contents of its own copy. This actually lost me lots of code.
--- End quote ---
Don't do it, use Notepad instead.
--- Quote from: Madoc on November 24, 2023, 12:38:55 pm ---This seems extremely problematic to me ...
--- End quote ---
I'm sorry you have problem using Lazarus. At the beginning I experienced similar issues too. But those didn't seem serious to me and can be easily avoided using Pluma/Notepad along with Lazarus.
Madoc:
Lazarus 2.2.6, OS is windows 11.
I did have a lot of stuff open, including the delphi IDE on another monitor, and was opening and viewing all sorts of files, but that's pretty normal for me. I did some simple tests after a restart and now if I close a file and reopen it in Lazarus it does revert. Not sure what was happening and can't really speculate without knowing how Lazarus handles files. I guess I'll keep going and see if it happens again.
Handoko:
I knew Lazarus has problem opening closing files. I haven't submit any bug report because I didn't dig deeper and that issue didn't seem important to me since I found using Pluma/Notepad could solve my problem.
You can do more tests and provide us a full explanation how to reproduce the issue, submit a bug report, it should be fix in the future releases. But remember, you need to make proper backup of your source code to prevent bad things that may happen.
Navigation
[0] Message Index
[#] Next page