Get current directory

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Stewie87
Posts: 34
Joined: Thu Apr 03, 2008 8:16 am

Get current directory

Post by Stewie87 »

Is there any no-kernel function to get the current directory where the eboot.pbp (my homebrew) has started?
I want to launch another PBP from my homebrew but I have to pass it the full path of the second homebrew otherwise i get the 8002013C error...
So I wish to get current directory where both PBPs are ;)

Thanks to all ^__^
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

Maybe you already did it, but keep searching for "getcwd".

Code: Select all

#include <string.h>
#include <sys/types.h>
#include <sys/unistd.h> // for getcwd&#40;&#41;
.
.
.
char fullName&#91;256&#93;;
getcwd&#40;fullName,200&#41;;
strcat&#40;fullName,filename&#41;;
Stewie87
Posts: 34
Joined: Thu Apr 03, 2008 8:16 am

Post by Stewie87 »

Yes, i tried it but it gave me always an undefinited reference error on "getcwd"... :(
Is there some lib that i have to include in my makefile to avoid it?
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

nope....my little sample compiles fine with this makefile
TARGET = pspgpslim236
OBJS = main.o ../commons/callbacks.o

INCDIR =
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

BUILD_PRX = 1
PSP_FW_VERSION=390

LIBDIR =
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = littleSample
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak

LIBS += -lpsphprm_driver -lpsprtc -lpspvfpu
Maybe yours is a compiler/sdk issue ??
Stewie87
Posts: 34
Joined: Thu Apr 03, 2008 8:16 am

Post by Stewie87 »

Now works (my build.mak was wrong! :P) but there is another issue: getcwd return NO string... only a empty path :(
Seems it does not work! Program run without problem but when i ask the current directory (using that function) fullName is empty... :'(
Are there other solutions?
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

Never tried with newer FW, but i know it _was_ working... should investigate
Stewie87
Posts: 34
Joined: Thu Apr 03, 2008 8:16 am

Post by Stewie87 »

jean wrote:Never tried with newer FW, but i know it _was_ working... should investigate
Maybe...
However i resolved! :D I get the current directory from argv[0] :)
Thank you for your help the same ;)
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

you were probably using the pspsdk libc instead of newlib. pspsdk libc doesn't set the cwd.
Stewie87
Posts: 34
Joined: Thu Apr 03, 2008 8:16 am

Post by Stewie87 »

moonlight wrote:you were probably using the pspsdk libc instead of newlib. pspsdk libc doesn't set the cwd.
Yes, infact i'm using the pspsdk libc :S
So i will search for these newlib :)

Thank you very much moonlight ;)
Post Reply