Forum > Russian

Lazarus and MacOS

<< < (2/3) > >>

trev:
I lodged Bug 37753 with a suggestion that Lazarus be installed in /Users/[name]/Applications instead.

lucamar:

--- Quote from: trev on September 16, 2020, 01:30:39 am ---I think the issue is that Lazarus is not installed in a user writable location. When Lazarus compiles itself it creates a new executable in your home directory .lazarus subdirectory, but when you restart Lazarus the next time it starts the original executable.

--- End quote ---

The former is the case on all *nixes (Linux, BSD, etc.) and startlazarus is clever enough to look for a custom Lazarus under ~/.lazarus first, so the problem seems to be: what is different in MacOS that it doesn't do so?

Первый характерен для всех * nix (Linux, BSD и т. Д.), И startlazarus достаточно умен, чтобы сначала искать пользовательский Lazarus в ~/.lazarus, поэтому проблема, похоже, в следующем: чем отличается MacOS от того, чего она не делает?

skalogryz:

--- Quote from: lucamar on September 16, 2020, 04:22:58 pm ---The former is the case on all *nixes (Linux, BSD, etc.) and startlazarus is clever enough to look for a custom Lazarus under ~/.lazarus first, so the problem seems to be: what is different in MacOS that it doesn't do so?

--- End quote ---
I really don't know about that!
FPC 3.2.0 change the behavior of FileExists() function for Nixes. Prior to Fpc 3.2 it would return TRUE for directories, on FPC 3.2 it returns FALSE. (this has been done for Windows compatibility)

However FileExists() has been used through out the code in Lazarus itself to figure out if bundle directory exists.
Turning all clever code into a pretty dumb and buggy lines... Lazarus IDE was fixed.
And I'm not sure similar fixes are needed for startLazarus. Maybe it does!

Alextp:
Startlazarus uses Lazarusmanager unit. It has this code with lot of FileExists-

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---function TLazarusManager.RenameLazarusExecutable(const Directory: string  ): TModalResult;var  NewFilename: String;  BackupFilename: String;  CurFilename: String;begin  NewFilename:=AppendPathDelim(Directory)+'lazarus.new'+GetExeExt;  BackupFilename:=AppendPathDelim(Directory)+'lazarus.old'+GetExeExt;  CurFilename:=AppendPathDelim(Directory)+'lazarus'+GetExeExt;  if FileExistsUTF8(NewFileName) then  begin    if FileExistsUTF8(CurFilename) then    begin      if FileExistsUTF8(BackupFileName) then        if not DeleteFileUTF8(BackupFileName) then begin          MessageDlg (format('Can''t delete "%s"'+LineEnding+'%s',            [BackupFileName, SysErrorMessageUTF8(GetLastOSError)]),            mtError, [mbOK], 0);          Result := mrAbort;          exit;        end;      if not RenameFileUTF8(CurFilename, BackupFileName) then begin        MessageDlg (format('Can''t rename "%s" to "%s"'+LineEnding+'%s',          [CurFilename, BackupFileName, SysErrorMessageUTF8(GetLastOSError)]),          mtError, [mbOK], 0);        Result := mrAbort;        exit;      end;      InvalidateFileStateCache;    end;    if not RenameFileUTF8(NewFileName, CurFilename) then begin      MessageDlg (format('Can''t rename "%s" to "%s"'+LineEnding+'%s',        [NewFileName, CurFilename, SysErrorMessageUTF8(GetLastOSError)]),        mtError, [mbOK], 0);      Result := mrAbort;      exit;    end;    InvalidateFileStateCache;  end;  Result:=mrOk;end;  

skalogryz:
in this particular case use of FileExist is appropriate

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version