Tam Hanna wrote:
I am currently writing a VFS file selection dialogue that is planned to be
open source eventually. I-however-now have the problem that I cannot find
out how the home directory of memory cards is called. The problem I have is that no matter if I have home set to "\\", "/", "",
the code works well in the simulator. However, it always dies on my T3 when
trying to enumerate an SD card there as it simply doesn't stop
enumerating(the loop never ends)!

//It is now time to enumerate a volume
......
                        FileInfoType tempInfo={NULL,NULL,NULL};//Init struct
prts
                        FileRef enumerateRef;
                        UInt32 vfsIterator=vfsIteratorStart;
                        UInt32 number=0;
                        char home[4]="//";
                        clearMemories();
                        VFSFileOpen(volRefNum, home, vfsModeRead,
&enumerateRef);

while (vfsIterator != vfsIteratorStop) { if (VFSDirEntryEnumerate(enumerateRef,&vfsIterator,&tempInfo) == errNone) { number++; } }
                        vfsIterator=vfsIteratorStart;

What value must I use for home;

The root folder is called "/", so "/" is what you should use.

However, the problem with your code is that you have put NULLs in
the tempInfo struct.  You need to allocate a buffer and put a
pointer to that buffer and the size of the buffer into the struct.
VFSDirEntryEnumerate() will not allocate a buffer for you.

Also, it doesn't make a lot of sense to initialize all three fields
to NULL, since only one field is a pointer.

Finally, it might be a good idea to put a "break;" to break out of
the loop if VFSDirEntryEnumerate() does return an error.  That
might have prevented the infinite loop on the T|T3.

  - Logan

--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to