Fixed broken path code in sdmc_dev.c. Disabled attributes code in sdmc_open() for now, since that was causing file truncation(even with read-only file opening).
This commit is contained in:
parent
b30a8d4d3d
commit
bd9c33e139
@ -141,6 +141,10 @@ sdmc_open(struct _reent *r,
|
|||||||
Result rc;
|
Result rc;
|
||||||
u32 sdmc_flags = 0;
|
u32 sdmc_flags = 0;
|
||||||
u32 attributes = FS_ATTRIBUTE_NONE;
|
u32 attributes = FS_ATTRIBUTE_NONE;
|
||||||
|
char *pathptr = NULL;
|
||||||
|
|
||||||
|
pathptr = strchr(path, '/');
|
||||||
|
if(pathptr==NULL)pathptr = (char*)path;
|
||||||
|
|
||||||
/* get pointer to our data */
|
/* get pointer to our data */
|
||||||
sdmc_file_t *file = (sdmc_file_t*)fileStruct;
|
sdmc_file_t *file = (sdmc_file_t*)fileStruct;
|
||||||
@ -181,11 +185,11 @@ sdmc_open(struct _reent *r,
|
|||||||
/* TODO: Test O_EXCL. */
|
/* TODO: Test O_EXCL. */
|
||||||
|
|
||||||
/* set attributes */
|
/* set attributes */
|
||||||
if(!(mode & S_IWUSR))
|
/*if(!(mode & S_IWUSR))
|
||||||
attributes |= FS_ATTRIBUTE_READONLY;
|
attributes |= FS_ATTRIBUTE_READONLY;*/
|
||||||
|
|
||||||
/* open the file */
|
/* open the file */
|
||||||
rc = FSUSER_OpenFile(NULL, &fd, sdmcArchive, FS_makePath(PATH_CHAR, path),
|
rc = FSUSER_OpenFile(NULL, &fd, sdmcArchive, FS_makePath(PATH_CHAR, pathptr),
|
||||||
sdmc_flags, attributes);
|
sdmc_flags, attributes);
|
||||||
if(rc == 0)
|
if(rc == 0)
|
||||||
{
|
{
|
||||||
@ -516,10 +520,14 @@ sdmc_mkdir(struct _reent *r,
|
|||||||
int mode)
|
int mode)
|
||||||
{
|
{
|
||||||
Result rc;
|
Result rc;
|
||||||
|
char *pathptr = NULL;
|
||||||
|
|
||||||
|
pathptr = strchr(path, '/');
|
||||||
|
if(pathptr==NULL)pathptr = (char*)path;
|
||||||
|
|
||||||
/* TODO: Use mode to set directory attributes. */
|
/* TODO: Use mode to set directory attributes. */
|
||||||
|
|
||||||
rc = FSUSER_CreateDirectory(NULL, sdmcArchive, FS_makePath(PATH_CHAR, path));
|
rc = FSUSER_CreateDirectory(NULL, sdmcArchive, FS_makePath(PATH_CHAR, pathptr));
|
||||||
if(rc == 0)
|
if(rc == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -543,12 +551,16 @@ sdmc_diropen(struct _reent *r,
|
|||||||
{
|
{
|
||||||
Handle fd;
|
Handle fd;
|
||||||
Result rc;
|
Result rc;
|
||||||
|
char *pathptr = NULL;
|
||||||
|
|
||||||
|
pathptr = strchr(path, '/');
|
||||||
|
if(pathptr==NULL)pathptr = (char*)path;
|
||||||
|
|
||||||
/* get pointer to our data */
|
/* get pointer to our data */
|
||||||
sdmc_dir_t *dir = (sdmc_dir_t*)(dirState->dirStruct);
|
sdmc_dir_t *dir = (sdmc_dir_t*)(dirState->dirStruct);
|
||||||
|
|
||||||
/* open the directory */
|
/* open the directory */
|
||||||
rc = FSUSER_OpenDirectory(NULL, &fd, sdmcArchive, FS_makePath(PATH_CHAR, path));
|
rc = FSUSER_OpenDirectory(NULL, &fd, sdmcArchive, FS_makePath(PATH_CHAR, pathptr));
|
||||||
if(rc == 0)
|
if(rc == 0)
|
||||||
{
|
{
|
||||||
dir->fd = fd;
|
dir->fd = fd;
|
||||||
|
Loading…
Reference in New Issue
Block a user