Rockbox Development > Starting Development and Compiling

Requesting Coding help

<< < (2/3) > >>

saratoga:
dir.c defines a funtion readdir function that returns a list of directory contents.  I haven't used it, but it seems like it would be ok.

Does you function need to search subdirectories?  If not, then just get the file list and see if its there.  If yes, then after that step, call the function recursively on each of the directories in the folder.  I don't think you can recurse all that much on embedded systems, but theres not all that many directories in Rockbox anyway, so it'd probably be ok.  

Jazz00006:
yeah, i guess it needs the readdir, for (.rockbox/rocks) then find the file. i was gonna try and make it find

.rockbox/rocks/dummy.rock FYI


working on it now

Jazz00006:
this is what i have got so far... havent tested it yet

i know thats a butched copy of the disktidy, but its all i have to go off at the moment


updated trial script(test2)

[attachment deleted by admin, too old]

LinusN:
I think you should ask yourself why you want to look for the file instead of just trying to open it and use it. A quick example of what I mean:


--- Code: ---char buffer[256];
int f, rc;
f = rb->open("/.rockbox/rocks/myrock.rock", O_RDONLY);
if(f < 0) {
   rb->splash(HZ, true, "Can't open file");
} else {
   rc = rb->read(f, buffer, 256);
}

etc...

--- End code ---

Jazz00006:
meh, what you have does the job  :D

i only wanted to check for the file, not run it at first, then i was going to learn how to run it :)


thanx alot

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version