newLISP Fan Club

Forum => newLISP and the O.S. => Topic started by: zhanglong on March 15, 2014, 03:05:05 AM

Title: on windows nl-filesys.c's isFile has a bug
Post by: zhanglong on March 15, 2014, 03:05:05 AM
stat return -1 for string like "d:". But in isFile isDirectory "d:/" is changed to "d:" before transfer to stat, we should check before temporary replace last  or / to NUL.



maybe change



if (slash == '\' || slash == '/')

    *(fileName + len - 1) = 0;



to



if ((slash == '\' || slash == '/') && (! (len >= 2 && *(fileName + len - 2) == ':')))

    *(fileName + len -1) = 0;
Title: Re: on windows nl-filesys.c's isFile has a bug
Post by: Lutz on March 15, 2014, 08:11:14 AM
Thanks Zhanglong, this has been changed for the next version for both isFile() and isDir().