LCL? - Working with files and directory's lazarus / 21-General ---------------------------------------------------------------------- djongepier · 2025-05-14 09:36 Hello all, I'm having some trouble finding the procedures related to file handling. These are the things I want to do: - Check if file/directory exists - Find exe's in the PATH variable - Read from environment variables For context, I have some experience with Python's pathlib, this might color my expectations. Lot's of things are kind of new and I am not really familiar yet with the style of naming I guess. ---------------------------------------------------------------------- Handoko · 2025-05-14 09:48 These should be what you need: https://www.freepascal.org/docs-html/rtl/sysutils/fileexists.html https://www.freepascal.org/docs- html/rtl/sysutils/getenvironmentvariable.html Quote from: djongepier on May 14, 2025, 11:36:38 amLot's of things are kind of new and I am not really familiar yet with the style of naming I guess. Just ask, people here are very nice and helpful. If you're new in Lazarus or programming in general, you can download, try and study these demos: https://wiki.freepascal.org/Portal:HowTo_Demos ---------------------------------------------------------------------- Fibonacci · 2025-05-14 09:50 Quote from: djongepier on May 14, 2025, 11:36:38 am- Find exe's in the PATH variable 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 uses SysUtils; function where(file_: unicodestring): unicodestring;var  u: unicodestring;begin  result := '';  for u in unicodestring(GetEnvironmentVariable('PATH')).Split([';']) do    if FileExists(IncludeTrailingBackslash(u)+file_) then      exit(IncludeTrailingBackslash(u)+file_);end; begin  writeln(where('fpc.exe'));  writeln(where('calc.exe'));  readln;end. ---------------------------------------------------------------------- olatov · 2025-05-14 09:53 There's ExeSearch in SysUtils https://www.freepascal.org/docs-html/rtl/sysutils/exesearch.html ---------------------------------------------------------------------- Fibonacci · 2025-05-14 09:59 Quote from: Nimbus on May 14, 2025, 11:53:27 amThere's ExeSearch in SysUtils https://www.freepascal.org/docs-html/rtl/sysutils/exesearch.html I knew it I was looking for "find" word ---------------------------------------------------------------------- Thaddy · 2025-05-14 10:52 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 {$macro on}{$define FindExecutables:= ExeSearch}Will help to find it.. ---------------------------------------------------------------------- djongepier · 2025-05-14 10:59 Quote from: Nimbus on May 14, 2025, 11:53:27 amThere's ExeSearch in SysUtils https://www.freepascal.org/docs-html/rtl/sysutils/exesearch.html That's what I need, although, I use the SysUtils unit, but the identifier is not found. Which leads me to believe it's in some other unit? ---------------------------------------------------------------------- djongepier · 2025-05-14 11:03 Nevermind, got it! Somehow my brain had a fart and added the C in ExeSearch, like so 'ExecSearch' which does not work. Look at the screenshot.