Here is the tested and WORKING code sequence 
IIRC I had to fix the testSuite in a couple of places

I did run the test suite twice , 
once on the boot volume ( case insensitive by default )
The second time on an external disk with a case sensitive file system


Pathconf needs  the  file or directory to exist 

Darwin case sensitiveness applies to each file system 
So in case of file not found it will return the system case sensitiveness 

On NOT Darwin systems it will just cost one extra call , 
If You are trying to squeeze performance to the last bit
The second call could be #ifdeffed  ,

Cheers 
E 



/**
 * indicate whether the file system is case sensitive.
 *
 * @return For Unix systems, always returns true. For MacOS,
 *         this needs to be determined on a case-by-case basis.
 *         This returns the information for the root file system
 */
bool SysFileSystem::isCaseSensitive()
{
#ifdef HAVE_PC_CASE_SENSITIVE
    long res = pathconf("/", _PC_CASE_SENSITIVE);
    if (res != -1)
    {
        return (res==1);
    }
#endif
    // any error means this value is not supported for this file system
    // so the result is most likely true (unix standard)
    return true;
}

/**
 * test if an individual file is a case sensitive name
 *
 * @return For Unix systems, always returns true. For MacOS,
 *         this needs to be determined on a case-by-case basis.
 */
bool SysFileSystem::isCaseSensitive(const char *name)
{
#ifdef HAVE_PC_CASE_SENSITIVE
    long res = pathconf(name, _PC_CASE_SENSITIVE);
    if (res != -1)
    {
        return (res==1) ;
    }
    // probably file not found
    // returns the information for the root file system
    res = pathconf("/", _PC_CASE_SENSITIVE);
    if (res != -1)
    {
        return (res==1) ;
    }
#endif
    // any error means this the value is not supported for this file system
    // so the result is most likely true (unix standard)
    return true;
}




> On 18 Feb 2019, at 21:52, Erich Steinböck <erich.steinbo...@gmail.com> wrote:
> 
> PC_CASE_SENSITIVE

_______________________________________________
Oorexx-devel mailing list
Oorexx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/oorexx-devel

Reply via email to