forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get current directory

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Stewie87



Joined: 03 Apr 2008
Posts: 39

PostPosted: Fri Aug 22, 2008 7:21 pm    Post subject: Get current directory Reply with quote

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 ^__^
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Fri Aug 22, 2008 7:31 pm    Post subject: Reply with quote

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

Code:
#include <string.h>
#include <sys/types.h>
#include <sys/unistd.h> // for getcwd()
.
.
.
char fullName[256];
getcwd(fullName,200);
strcat(fullName,filename);
Back to top
View user's profile Send private message
Stewie87



Joined: 03 Apr 2008
Posts: 39

PostPosted: Fri Aug 22, 2008 7:44 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Fri Aug 22, 2008 7:52 pm    Post subject: Reply with quote

nope....my little sample compiles fine with this makefile

Quote:
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 ??
Back to top
View user's profile Send private message
Stewie87



Joined: 03 Apr 2008
Posts: 39

PostPosted: Fri Aug 22, 2008 8:20 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Fri Aug 22, 2008 8:36 pm    Post subject: Reply with quote

Never tried with newer FW, but i know it _was_ working... should investigate
Back to top
View user's profile Send private message
Stewie87



Joined: 03 Apr 2008
Posts: 39

PostPosted: Fri Aug 22, 2008 8:38 pm    Post subject: Reply with quote

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 ;)
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Fri Aug 22, 2008 10:41 pm    Post subject: Reply with quote

you were probably using the pspsdk libc instead of newlib. pspsdk libc doesn't set the cwd.
Back to top
View user's profile Send private message
Stewie87



Joined: 03 Apr 2008
Posts: 39

PostPosted: Sat Aug 23, 2008 1:06 am    Post subject: Reply with quote

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 ;)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group