Windows bug report + possible fix

bugs buggy buginator07 at gmail.com
Fri Nov 9 12:16:34 EST 2007


Hi, I ran into a issue with physfs & windows.

The test program output is as follows:
> mkdir blah
Failure. reason: Write directory is not set.
> setwritedir .
Successful.
> mkdir blah
Successful.
> delete blah
Successful.
> setwritedir n:\abmer
Successful.
> mkdir blah
Successful.
> delete blah
Failure. reason: Access is denied..
> write fileblah
Successful.
> delete fileblah
Successful.
> delete blah
Failure. reason: Access is denied..
> q

I looked deeper into the physfs 1.1.1 code, and I noticed this line
(1212) in windows.c
    if (pGetFileAttributesW(wpath) == FILE_ATTRIBUTE_DIRECTORY)

The issue is that pGetFileAttributesW(wpath)  was returning 0x2010  which is :
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED |  FILE_ATTRIBUTE_DIRECTORY

So obviously it fails on the above piece of code.
I changed the line to read :
if (pGetFileAttributesW(wpath) & FILE_ATTRIBUTE_DIRECTORY)

and it works as it should now.

> mkdir blah
Failure. reason: Write directory is not set.
> setwritedir .
Successful.
> mkdir blah
Successful.
> delete blah
Successful.
> setwritedir n:\abmer
Successful.
> mkdir blah
Successful.
> delete blah
Successful.
> q

Thanks for your time.


--Buginator



More information about the physfs mailing list