[Solved] ReWrite TextFile caused error on linux lazarus / 32-Linux ---------------------------------------------------------------------- senglit · 2022-02-27 10:39 hi, I got this code which ran with no problem on win10. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     fn := BASEDIR + '/Log/' + LeftStr(DateTimeToStr(now, FSetting), 10);    if not FileExists(fn) then begin      AssignFile(LogFile, fn);      Rewrite(LogFile);          //        <----- This line      CloseFile(LogFile);    end;     Today I compiled the progam on linux and it raised an error when the program went to the line "Rewrite(LogFile)". The error message is "project xxx raised exception class 'RunError(2)' with message "file not found" '. I've thought it's a standard way to create a new textfile and I did it since I was a young boy playing with delphi7... And it's also ok with Lazarus in windows. What should I do in linux? Must use TFileStream? ---------------------------------------------------------------------- senglit · 2022-02-27 10:50 My bad. I was so spoiled by windows and pascal language that I forgot linux is letter-case-sensitive. log = Log on windows and pascal but log <> Log on linux. how stupid I was. Quote from: senglit on February 27, 2022, 11:39:38 amhi, I got this code which ran with no problem on win10. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i     fn := BASEDIR + '/Log/' + LeftStr(DateTimeToStr(now, FSetting), 10);    if not FileExists(fn) then begin      AssignFile(LogFile, fn);      Rewrite(LogFile);          //        <----- This line      CloseFile(LogFile);    end;     Today I compiled the progam on linux and it raised an error when the program went to the line "Rewrite(LogFile)". The error message is "project xxx raised exception class 'RunError(2)' with message "file not found" '. I've thought it's a standard way to create a new textfile and I did it since I was a young boy playing with delphi7... And it's also ok with Lazarus in windows. What should I do in linux? Must use TFileStream?