Hi,
I'm playing around and compiling my first Rockbox plugin with the simulator but I'm having trouble opening files.
I'm doing this:
if (rb->file_exists(ROCKBOX_DIR"/foo/bar.txt"))
{
rb->splashf(2*HZ, "exists");
dp = fopen(ROCKBOX_DIR"/foo/bar.txt", "rt");
if (dp == NULL)
{
rb->splashf(2*HZ, "%d", errno);
return PLUGIN_OK;
}
else
{
/* I never get here */
do_something_with_bar();
}
}
Which gives me a splash confirming that my file exists in the location I am trying to access it.
However, when I make the fopen call to the same path I get an errno value of 2 which I believe indicates ENOENT No such file or directory. Do I need to transform the path somehow?
EDIT:
I've managed to get it to work by placing my files in the same directory as the rockboxui binary.
e.g. if you are trying to access a file like this:
open("/foo/bar.txt", "rt");
It will work if you place this in the build directory where the simulator is:
├── simdisk
├── foo
│ └── bar.txt
└── rockboxui
I'll work out if I need to change the path once the plugin is finished and I'm ready to test on hardware.