Lazarus

Miscellaneous => Suggestions => Topic started by: hayanninja on January 13, 2018, 01:11:07 am

Title: "File Not Found" message on file that *does* exist
Post by: hayanninja on January 13, 2018, 01:11:07 am
Windows 10 64-bit, NTFS partition, Lazarus 1.8.0.

Steps to reproduce:
1. Have a project open in Lazarus.
2. Manually create (via the OS, not Lazarus) a new .pas file. May need to be inside the project folder or at least a subfolder thereof, not sure. Your OS must be configured to open pas files in Lazarus. (I would assume this still happens with other extensions too.)
3. Double-click this file, to open it in Lazarus.
4. Lazarus will claim that the file does not exist when trying to open it and ask if you'd like to create it.
5. If you say "No", then try to open it a second time, it opens properly.

I have Mac and Linux installations of Lazarus too but have not tested if the bug also occurs there.
Title: Re: "File Not Found" message on file that *does* exist
Post by: Handoko on January 13, 2018, 08:35:06 am
I can reproduce it on Lazarus 1.8.0 64-bit Gtk2 on Ubuntu Mate 17.10.
Title: Re: "File Not Found" message on file that *does* exist
Post by: Handoko on January 13, 2018, 08:40:43 am
But sometimes I got different message:
Title: Re: "File Not Found" message on file that *does* exist
Post by: howardpc on January 13, 2018, 11:14:35 am
I suppose technically this behaviour is a bug.
However, it is hardly worth bothering with, since it only appears when a developer abuses the IDE.

Lazarus, in the nature of things, closely manages all .lpr, .pas, .pp, .lfm, .inc files and the like in the current project. This is required for the tight integration between the Designer, Object Inspector and Editor.
It is not unreasonable  for the IDE to assume that when you want a new file you will use File->New unit or File->New form (or File->New...) so that the IDE itself initiates creation of the new file, and is not just presented with an operating system novelty that you have forced into existence by some back door approach.
Title: Re: "File Not Found" message on file that *does* exist
Post by: molly on January 13, 2018, 11:29:36 am
@howardpc:

Isn't it so that it is lazarus 'choice' to only invoke one instance. And to accept parameters, opening a file (in existing or freshly launched instance) if that would to be the case. If so, isn't it so that it is lazarus choice to 'open' a file when another project is open ?

I agree that it is a OS 'backdoor', but one that is conveniently used/supported/implemented by Lazarus, so also the consequences of implementing that the correct way even if the user shouldn't do it. I haven't seen this advertised as 'forbidden' in the Lazarus manuals.

2 cents.
Title: Re: "File Not Found" message on file that *does* exist
Post by: howardpc on January 13, 2018, 11:37:32 am
@molly

Forbidding behaviour is guaranteed to get a certain type of person to behave that way just for the hell of it.
But you are probably right. And a patch to change how the IDE reacts to this sort of back door file manipulation would probably be accepted.
I shan't be the one to waste time on producing such a patch, however.

You know the story of the man who was found banging his head against a wall? "Why are you doing that?" he was asked.
"Because it is such a relief when I stop" he replied.
Title: Re: "File Not Found" message on file that *does* exist
Post by: Thaddy on January 13, 2018, 11:39:28 am
Lazarus, in the nature of things, closely manages all .lpr, .pas, .pp, .lfm, .inc files and the like in the current project. This is required for the tight integration between the Designer, Object Inspector and Editor.
It is not unreasonable  for the IDE to assume that when you want a new file you will use File->New unit or File->New form (or File->New...) so that the IDE itself initiates creation of the new file, and is not just presented with an operating system novelty that you have forced into existence by some back door approach.
You actually missed lpi files and these are likely the cause imo. Lazarus wants to turn everything into a project. It also demands read/write access even if instructed to compile to somewhere else.
Title: Re: "File Not Found" message on file that *does* exist
Post by: molly on January 13, 2018, 11:44:58 am
@howardpc:
Walls and heads, yes  :)

Perhaps i did not express myself corectly in my previous post. I couldn't care if it was to be supported or not,but when not then at least prevent the user from doing so.

e.g. User error: trying to open a file while project is open.... or better yet, ignore the new invocation altogether.

In most luxurious case:  Lazarus - you are trying to open a .pas file while you have a project open, what do you want to do:
1) close project, open .pas
2) ignore this .pas file.
2a) add this .pas file to project
3) quit lazarus
4) browse the internet
5) play pong
Title: Re: "File Not Found" message on file that *does* exist
Post by: Ñuño_Martínez on January 13, 2018, 01:35:16 pm
Curious. I had a similar behaviour yesterday on Windows XP SP3.  Not latest Lazarus IIRC (I don't have that computer here now, but I think it is the latest 1.6 release).  It happened only once so I didn't worried about it.
Title: Re: "File Not Found" message on file that *does* exist
Post by: ASerge on January 13, 2018, 04:28:50 pm
Windows 10 64-bit, NTFS partition, Lazarus 1.8.0.

Steps to reproduce:
1. Have a project open in Lazarus.
2. Manually create (via the OS, not Lazarus) a new .pas file. May need to be inside the project folder or at least a subfolder thereof, not sure. Your OS must be configured to open pas files in Lazarus. (I would assume this still happens with other extensions too.)
3. Double-click this file, to open it in Lazarus.
4. Lazarus will claim that the file does not exist when trying to open it and ask if you'd like to create it.
5. If you say "No", then try to open it a second time, it opens properly.
Windows 7 64 bit, NTFS partition, Lazarus 1.8.0
Reproduced, but only if the following conditions are met:
1. The project must at least once be compiled.
2. The length of the name without extension is less than 4 characters.
Title: Re: "File Not Found" message on file that *does* exist
Post by: Bart on January 13, 2018, 05:43:27 pm
A similar bug when dragging a file onto Lazarus exists and is reported in the bugtracker somewhere.

Bart
Title: Re: "File Not Found" message on file that *does* exist
Post by: Bart on January 13, 2018, 05:55:47 pm
See Issue #28154 (https://bugs.freepascal.org/view.php?id=28154).
It may be related.

Bart
Title: Re: "File Not Found" message on file that *does* exist
Post by: hayanninja on January 15, 2018, 04:54:45 am
Looks like the same issue to me, the only difference is it's triggered by opening the file from Windows Explorer rather than by drag-and-drop.
TinyPortal © 2005-2018