Loading file from "current" directory

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

Moderators: cheriff, TyRaNiD

Post Reply
milksop
Posts: 10
Joined: Fri Jun 24, 2005 6:10 pm

Loading file from "current" directory

Post by milksop »

Does anyone know how to sceIoOpen a file in the current directory? Or other suggestions on how to load a file from the PBP directory that don't involve hardcoding the path from ms0:/ all the way up?

thanks,
scott
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

From Vectoroids:

Code: Select all

  /* Used for building a path to data files. */
  char psp_filename[1024 + 1];
  /* Get the full path to EBOOT.PBP. */
  char psp_full_path[1024 + 1];
  char *psp_eboot_path;
  
  strncpy(psp_full_path, argv[0], sizeof(psp_full_path) - 1);
  psp_full_path[sizeof(psp_full_path) - 1] = '\0';
  
  psp_eboot_path = strrchr(psp_full_path, '/');
  if (psp_eboot_path != NULL)
    {
      *psp_eboot_path = '\0';
    }
Then just use sprintf(filename, "%s/%s", psp_full_path, local_path).
milksop
Posts: 10
Joined: Fri Jun 24, 2005 6:10 pm

Post by milksop »

Oh, duh. Thanks. I didn't notice that argv was getting set properly in _start for sceKernelStartThread.
Post Reply