Forum > General
mac - If FileExists(fileName) always returns false
TRon:
--- Quote from: dsiders on June 15, 2024, 12:24:15 am ---And Tim Cook's shoe size.
--- End quote ---
Which happens to be ... 42 ? :D
madref:
i had that problem...
Take a look here https://forum.lazarus.freepascal.org/index.php/topic,67246.0.html
JdeHaan:
Hi,
On MacOS you need to use the full file path, including the name and file extension, e.g.:
/Users/YourName/Documents/Programming/Projects/new/test.pas
In the Finder window, select the respective file. At the bottom of the window you'll find the breadcrumb path. Right click on the file name and click "Copy 'test.xyz' as Pathname".
Paste the copied path into your code.
see attached example of the breadcrumb.
Thaddy:
It does not have to be a full path, on mac it also works with relative paths (at least it used to) './test'
MarkMLl:
This one ain't my fight since I'm not a Mac user, but I'd point out that
* OP hasn't told us whether "test" is a file or a directory/folder.
* OP hasn't told us what version of FPC he's using.
* A year or so ago the behaviour of FileExists() was changed to explicitly ignore directories in all cases.
MarkMLl
Navigation
[0] Message Index
[#] Next page
[*] Previous page