paragui-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [paragui-users] newbie question : open file dialog window


From: John Rainey
Subject: RE: [paragui-users] newbie question : open file dialog window
Date: Thu, 6 Jun 2002 12:18:02 -0400

I too am working on a open dialog. I have found a problem with the file
system archive in win32.c

The __PHYSFS_platformEnumerateFiles function drops the first file name in a
directory/archive. It gets the first file, checks to see if it is valid then
enters a for loop to fill the array, however when entering the loop it gets
the next file. I have changed this to a do while loop.

I am using paragui 1.0.1. Has this been found and fixed in 1.0.2????

CODE ENCLOSED

LinkedStringList *__PHYSFS_platformEnumerateFiles(const char *dirname,
                                                  int omitSymLinks)
{
    LinkedStringList *retval = NULL;
    LinkedStringList *l = NULL;
    LinkedStringList *prev = NULL;
    HANDLE dir;
    WIN32_FIND_DATA ent;

    dir = FindFirstFile(dirname, &ent);
    BAIL_IF_MACRO(dir == INVALID_HANDLE_VALUE, win32strerror(), NULL);

    // jpr 060602 the next line increments the file pointer to the next file
before the first is added
    // for (; FindNextFile(dir, &ent) != 0; )
   // changed for loop to do->while loop
    do
    {
        if (strcmp(ent.cFileName, ".") == 0)
            continue;

        if (strcmp(ent.cFileName, "..") == 0)
            continue;

        l = (LinkedStringList *) malloc(sizeof (LinkedStringList));
        if (l == NULL)
            break;

        l->str = (char *) malloc(strlen(ent.cFileName) + 1);
        if (l->str == NULL)
        {
            free(l);
            break;
        } /* if */

        strcpy(l->str, ent.cFileName);

        if (retval == NULL)
            retval = l;
        else
            prev->next = l;

        prev = l;
        l->next = NULL;
    } while(FindNextFile(dir, &ent) != 0);

    FindClose(dir);
    return(retval);
} /* __PHYSFS_platformEnumerateFiles */

-----Original Message-----
From:   address@hidden
[mailto:address@hidden On Behalf Of Teunis
Peters
Sent:   Wednesday, June 05, 2002 10:19 PM
To:     address@hidden
Subject:        Re: [paragui-users] newbie question : open file dialog window

On Wed, 5 Jun 2002, Andrew Ford wrote:

> Hmmm, font selector would be tough, but the others
> sound like good ideas.  I personally wonder if these
> are the sorts of things that we should be adding
> directly to the library.  We either add, say, A dialog
> box, file dialog, whatever, directly into the
> hierarchy of the library, or we add them into the
> source distribution as "extras" or code-bits for those
> who need them (like pgmpeg).  What does everyone
> think?

I think extension lib too - like 'paragui-tools' or 'libparagui-tools'
or even paragui-comctl *grin* to echo the windows equivalent of a similar
toolkit.

And skins are good - pluggable looks-and-feels rock :)
or wait... hrm...  more on that thought later.

G'day, eh? :)
        - Teunis


_______________________________________________
paragui-users mailing list
address@hidden
http://mail.freesoftware.fsf.org/mailman/listinfo/paragui-users




reply via email to

[Prev in Thread] Current Thread [Next in Thread]