Current working dir?
Current working dir?
Can anyone tell me how to get the current working directory? or rather, since there doesnt seem to be one (all paths seem to be absolute), the directory the elf lives in?
Depends, argv[0] is setup by the program which loaded the module, if the launcher doesn't do it correct it will not work. The Sony shell does it, psplink does it, not idea about any other launcher.
The libc which comes with the toolchain _should_ extract the current directory information for you and allow you to call open/opendir etc. with relative paths, but best print out argv[0] to see if you have actually got the path to the executable in there.
The libc which comes with the toolchain _should_ extract the current directory information for you and allow you to call open/opendir etc. with relative paths, but best print out argv[0] to see if you have actually got the path to the executable in there.
eLoader also passes the correct argv[0] by default. You can turn that behaviour off so that it passes NULL, but it's unlikely you've done that.
Note that the stdlib functions all rely on the module being passed the correct argv[] in the first place, if that didn't happen then all standard functions (such as cwd()) will have problems.
Note that the stdlib functions all rely on the module being passed the correct argv[] in the first place, if that didn't happen then all standard functions (such as cwd()) will have problems.
Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you!
The PSP Homebrew Database needs you!