Joined: 12 Feb 2007
|Posted: Thu Jan 13, 2011 6:19 am Post subject: sceIoDopen and opendir behavior
so, here I am after a looong time asking again for some light. Here's my problem:
I wrote an e-book reader, or well, a formatted-text reader, but among other things, this had me write also some kind of a file browser. So far so good.
Just for my curiosity, I wanted it to work also with the UMD, so I got it... somehow, but noted the following (please, note that i _want_ to use opendir and closedir, not the sceIoDopen and Dclose functions):
opendir doesn't work with - for example - "ms0:", as the internal call to __psp_path_absolute trats that entry as a relative path, and adds the cwd at the beginning. However, this is not an issue, as I may call it _always_ with a terminating slash; in which case the path changes from "ms0:/" to "ms0:" and everything works.
The strange thing comes when I need to open the UMD (which I previously initialized to "disc0:" - which, by the way, is the only one working, as I tried also "umd0:", "disk0:", etc. without success).
Now, while sceIoDopen("ms0:") works fine, sceIoDopen("disc0:") doesn't (and this is what sceIoDopen gets when internally called by opendir...).
That is, I _must_ pass "disc0:/" to it to correctly open the path (note the final slash).
Are you aware of this behavior? Obviously this is a bug in the sceIoDopen function (or a feature? as I discovered also other interesting things about the attributes of the files in the UMD...)
Is there anything I can do to have it correctly working, or is patching the opendir function the only solution I am left with? (the patch is indeed a one-liner, but I need to erwrite the whole function, or, ehm, recompile the toolchain...)
Sorry for the long tome...
Thanks to anyone who can help.