Recent

Author Topic: Delphi converter gives repeated write error  (Read 335 times)

TyneBridges

  • Full Member
  • ***
  • Posts: 143
    • Personal blog
Delphi converter gives repeated write error
« on: December 24, 2020, 06:29:31 pm »
I'm trying to convert an old Windows project (which I know will be difficult) to Lazarus. I have Lazarus 2.0.10 on Windows 10 and am using the option Tools > Delphi Conversion > Convert Delphi Project to Lazarus Project.

I had one attempt which produced a converted project but this failed to compile because of errors in Delphi's Windows unit (which I gather is a common problem). However, now I can't even get the converter to start - it keeps telling me "Unable to write to file whatever.lpr". I can see Lazarus has created a .lpi and a .lps file and "Automatic Conversion.log" which just tells me what I know, that I aborted the operation (after seeing these repeated errors).

I've tried creating a new folder, moving my original project into it and double checking the permissions (I have full control) but the same inexplicable error keeps popping up. The file attributes show the folder as "Read only" but I've repeatedly removed this and, from what I read, it's a quirk of Windows that can be ignored.

Any idea why this is happening, or why Lazarus should stick on the lpr file?

Thanks.
John H, north east England
Lover of the old Delphi, still inexperienced with FPC/Lazarus and not an instinctive programmer

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3933
  • I like bugs.
Re: Delphi converter gives repeated write error
« Reply #1 on: December 24, 2020, 07:35:43 pm »
I had one attempt which produced a converted project but this failed to compile because of errors in Delphi's Windows unit (which I gather is a common problem).
After conversion you are using FPC's Windows unit, right? It should be more or less compatible with the Delphi's unit.
What errors does it have?

Quote
However, now I can't even get the converter to start - it keeps telling me "Unable to write to file whatever.lpr". I can see Lazarus has created a .lpi and a .lps file and "Automatic Conversion.log" which just tells me what I know, that I aborted the operation (after seeing these repeated errors).

I've tried creating a new folder, moving my original project into it and double checking the permissions (I have full control) but the same inexplicable error keeps popping up. The file attributes show the folder as "Read only" but I've repeatedly removed this and, from what I read, it's a quirk of Windows that can be ignored.
"Read only" attribute in the folder sounds like a valid reason for such an error. You obviously need a folder that can be written to.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

TyneBridges

  • Full Member
  • ***
  • Posts: 143
    • Personal blog
Re: Delphi converter gives repeated write error
« Reply #2 on: December 24, 2020, 08:28:17 pm »
JuhaManninen, I think the converter was using the Delphi unit but, as I can't now run it, I can't reproduce it to check.

The "read only" tag is certainly confusing. I changed all the files to read/write but this kept coming back. I read that it's meaningless so have put it down to an eccentricity of Microsoft. When I look at my folders, which generally work fine, *all* of have them have the attached. I take this to mean that *something* but not everything there is read only...
John H, north east England
Lover of the old Delphi, still inexperienced with FPC/Lazarus and not an instinctive programmer

winni

  • Hero Member
  • *****
  • Posts: 2116
Re: Delphi converter gives repeated write error
« Reply #3 on: December 24, 2020, 08:42:13 pm »
Hi!

1. Disable the read-only flag for the directory and its files
2. Say YES to the next question.
3. If you need some files to be read-only then mark them file by file and change the read-only attribute

That is the way M$ forces you with the exporer.

Winni

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3933
  • I like bugs.
Re: Delphi converter gives repeated write error
« Reply #4 on: December 24, 2020, 09:41:36 pm »
JuhaManninen, I think the converter was using the Delphi unit but, as I can't now run it, I can't reproduce it to check.
No, the converter does not use anything from Delphi. Usually Delphi is not even installed in the machine where Lazarus runs. For example I use Manjaro Linux and Delphi would not work here. It would not work in MacOS either.

Note, the converter lets you choose between Windows only support or a cross-platform support.
If a program / application depends heavily on WinAPI, making it cross-platform requires effort. However a part of WinAPI is supported for cross-platform applications by LCLIntf etc. units.
In any case the automatic conversion usually is not enough. You must do manual changes, sometimes a little, sometimes more.
If an application uses some big Delphi component which is not ported to Lazarus, the conversion becomes very difficult.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018