Lazarus

Programming => General => Topic started by: Borneq on December 07, 2019, 10:55:41 pm

Title: Howe determine if filesystem is case sensitive?
Post by: Borneq on December 07, 2019, 10:55:41 pm
I am comparing paths using CompareText or CompareStr depend if is case sensitive filesystem.
Worse solution: what are conditionals for Windows, Linux and other case-sensitive, insensitive systems?
But it is not quite good: in Linux can I read Fat32 or NTFS, while is case insensitive, better would be ask for directory, for example '.' and determine sensitivity.
Title: Re: Howe determine if filesystem is case sensitive?
Post by: marcov on December 07, 2019, 11:01:21 pm
Afaik FPC does not deal with this on a file system basis, only with global variables FileNameCaseSensitive and FileNameCasePreserving
Title: Re: Howe determine if filesystem is case sensitive?
Post by: jamie on December 07, 2019, 11:02:02 pm
Write to temp files, one with Upper case the other as lower.. See if you get a file error when writing the second  :)
Title: Re: Howe determine if filesystem is case sensitive?
Post by: winni on December 07, 2019, 11:06:22 pm
Or the other way round:

Write filename  "MyFile"

Check if " MYFILE" exists.

Title: Re: Howe determine if filesystem is case sensitive?
Post by: PascalDragon on December 08, 2019, 11:30:49 am
I am comparing paths using CompareText or CompareStr depend if is case sensitive filesystem.
Worse solution: what are conditionals for Windows, Linux and other case-sensitive, insensitive systems?
But it is not quite good: in Linux can I read Fat32 or NTFS, while is case insensitive, better would be ask for directory, for example '.' and determine sensitivity.
Well, things have gotten even more complicated regarding that, because NTFS nowadays (Windows 10) supports per directory case sensitivity (for WSL) and Ext4 recently gained support for per directory case insensitivity...
Title: Re: Howe determine if filesystem is case sensitive?
Post by: ASBzone on December 08, 2019, 07:34:53 pm
I am comparing paths using CompareText or CompareStr depend if is case sensitive filesystem.
Worse solution: what are conditionals for Windows, Linux and other case-sensitive, insensitive systems?
But it is not quite good: in Linux can I read Fat32 or NTFS, while is case insensitive, better would be ask for directory, for example '.' and determine sensitivity.


What is your actual use case?

Why not always check using the case sensitive function?


-ASB
TinyPortal © 2005-2018