Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: RE: A few more questions
From: ds2list (ds2list_at_yahoo.com)
Date: 2003-05-02


A couple more questions if you don't mind ;)

Right now, I can find the name of the current directory in
tree.c by looking at dircache[dircursor+dirstart].name, but I
can't get the full pathname. How do I find the full pathname
to the current directory?

Also, when I do an open(filename, O_RDONLY) on a pathname to
a file that I know doesn't exist, open() doesn't return a
negative value. Is there anyway to check for the existence
of a particular file?

Thanks,

danan

On Fri, 02 May 2003 08:46:13 +0200, Daniel Stenberg wrote:

> On Thu, 1 May 2003, ds2list wrote:
>
>> 1) Given a pathname to an mp3 file, what sequence of function calls
>> (pseudo-code description is ok) does one need to do in order to
>> play the file? From what I can see in the code, it builds a
>> playlist for an entire directory when it plays a file, then
>> calls mpeg_play() on it. Is this right?
>
> Yes, that's right. There's basicly only one place in the code where we start
> playing a specific song, and that is when you select it on the dir browser.
> That function makes a playlist of the full dir first. It makes that to
> proceed with the next song when the selected one ends.
>
>> Could I build a playlist for just one file if I wanted to?
>
> Certainly.
>
>> 2) How are directories and files addressed in the API?
>
> For files: open() / close() / read() / write()
>
> For dirs: opendir() / readdir() / closedir()
>
>> Is it by file/directory name string?
>
> Yes.
>
>> I see lots of integers seeming to represent directories in the code.
>
> Those are file descriptors as returned by one of the function calls above, as
> in:
>
> int fd = open("/myfile.txt", O_RDONLY);
> if(fd >= 0) {
> /* we have the file opened, do something */
>
> close(fd); /* close file again */
> }
> else {
> /* failed to open the file */
> }
A couple more questions if you don't mind ;)

Right now, I can find the name of the current directory in
tree.c by looking at dircache[dircursor+dirstart].name, but I
can't get the full pathname. How do I find the full pathname
to the current directory?

Also, when I do an open(filename, O_RDONLY) on a pathname to
a file that I know doesn't exist, open() doesn't return a
negative value. Is there anyway to check for the existence
of a particular file?

Thanks,

danan

On Fri, 02 May 2003 08:46:13 +0200, Daniel Stenberg wrote:

> On Thu, 1 May 2003, ds2list wrote:
>
>> 1) Given a pathname to an mp3 file, what sequence of function calls
>> (pseudo-code description is ok) does one need to do in order to
>> play the file? From what I can see in the code, it builds a
>> playlist for an entire directory when it plays a file, then
>> calls mpeg_play() on it. Is this right?
>
> Yes, that's right. There's basicly only one place in the code where we start
> playing a specific song, and that is when you select it on the dir browser.
> That function makes a playlist of the full dir first. It makes that to
> proceed with the next song when the selected one ends.
>
>> Could I build a playlist for just one file if I wanted to?
>
> Certainly.
>
>> 2) How are directories and files addressed in the API?
>
> For files: open() / close() / read() / write()
>
> For dirs: opendir() / readdir() / closedir()
>
>> Is it by file/directory name string?
>
> Yes.
>
>> I see lots of integers seeming to represent directories in the code.
>
> Those are file descriptors as returned by one of the function calls above, as
> in:
>
> int fd = open("/myfile.txt", O_RDONLY);
> if(fd >= 0) {
> /* we have the file opened, do something */
>
> close(fd); /* close file again */
> }
> else {
> /* failed to open the file */
> }



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa