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 

getcwd in flash's and disc0:/

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



Joined: 24 Mar 2008
Posts: 25

PostPosted: Mon Jun 02, 2008 6:58 pm    Post subject: getcwd in flash's and disc0:/ Reply with quote

hi,
i have been struggling with geting the current working directory (getcwd(path,265)). i am trying to be able to acsess the flash directories and be able to browse throught them. and return the cwd.
here is some of my code
Code:
int fcwd = 0;
char *cwdpath = "";
static int lua_getCurrentDirectory(lua_State *L)
{
   
   char path[256];
   //cwdpath = getcwd(path,256);
   lua_pushstring(L, cwdpath);
   return 1;
}

static int lua_setCurrentDirectory(lua_State *L)
{
   char *path = luaL_checkstring(L, 1);
   if(!path) return luaL_error(L, "Argument error: System.currentDirectory(file) takes a filename as string as argument.");
   char *ddp = strpbrk (":",path);
   if(ddp != NULL)
   {
      sceIoChdir(path);
      chdir(path);
      cwdpath = path;
      lua_pushstring(L, cwdpath);
      return 1;
   }
   if(strcmp(cwdpath,"ms0:/") == 0)
   {
      sceIoChdir(path);
      chdir(path);
      strcat(cwdpath, path);
      lua_pushstring(L, cwdpath);
      return 1;
   }
   if(strcmp(cwdpath,"disc0:/") == 0)
   {
      sceIoChdir(path);
      chdir(path);
      strcat(cwdpath, path);
      lua_pushstring(L, cwdpath);
      return 1;
   }
      sceIoChdir(path);
      chdir(path);
      strcat(cwdpath, "/");
      strcat(cwdpath, path);
      lua_getCurrentDirectory(L);
   return 1;
}

Regards
Homemister
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