Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Bugs
  • Category User Interface → Simulator
  • Assigned To No-one
  • Operating System Gigabeat F/X
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes
  • Private
Attached to Project: Rockbox
Opened by JobVanDam - 2008-01-30
Last edited by jdgordon - 2008-01-31

FS#8532 - Code works properly on Sim but not on Target

I have a Gigabeat F40.
I wanted to make a small plugin for myself that traversed directories. To skip the first two files ('.' and '..') I used the following code:

DIR* dir; holds the current directory
struct dirent *entry;
holds the current file
char dirPath[MAX_PATH]; //holds the path to the current directory

dir = rb->opendir(dirPath);
    entry = rb->readdir(dir);
    entry = rb->readdir(dir);

In the simulator the code above worked. After the two readdir() statements entry would contain the first file in the directory.
On the actual target entry would still contain '.' .

I apologize if I reported this without following all proper procedures. If you need more information please let me know.
Thank you.

Closed by  jdgordon
2008-01-31 06:57
Reason for closing:  Fixed
Additional comments about closing:   Warning: Undefined array key "typography" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 371 Warning: Undefined array key "camelcase" in /home/rockbox/flyspray/plugins/dokuwiki/inc/parserutils.php on line 407

problem solved…

for next time.. this isnt the best place for this sort of support… irc or the dev mailing list

petur commented on 2008-01-30 21:57

I think on target the code always uses dircache. For FAT, the . and .. entries must always come first, but I'm not sure what dircache does with it.

This is what I used for the properties plugin:

  while(result && (0 != (entry = rb->readdir(dir))))
  {
        if (!rb->strcmp((char *)entry->d_name, ".") ||
              !rb->strcmp((char *)entry->d_name, ".."))
              continue; /* skip these */
        /* do whatever you need to here */
  }

Have a look at the properties plugin, it contains all the directory traversal code you need ;)

I did get my plugin to work it's just I thought this was a bug so I reported, thank you though for your help.

I actually looked to the stats plugin for help and my if statement looks the same as your example except I didn't use the 'not' operator in front of the strcmp calls.

Again thank you for the help.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing