Skip to content

Commit 069c85a

Browse files
author
cromwelldev
committed
cwd in VirtualRoot will contain trailing PathSep
Return result of fatxstat in debuglogger
1 parent a75eaba commit 069c85a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

fs/VirtualRoot/VirtualRoot.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ void VirtualRootInit(void)
7979

8080
FILEX vroot_open(const char* path, FileOpenMode mode)
8181
{
82-
XBlastLogger(DEBUG_VROOT, DBG_LVL_DEBUG, "path:\"%s\" mode:%u", path, mode);
82+
char workPath[300];
83+
sprintf(workPath, "%s%s", cwd, path);
84+
XBlastLogger(DEBUG_VROOT, DBG_LVL_DEBUG, "path:\"%s\" mode:%u", workPath, mode);
8385
if(NULL != currentAccessor)
8486
{
85-
return currentAccessor->open(path, mode);
87+
return currentAccessor->open(workPath, mode);
8688
}
8789
XBlastLogger(DEBUG_VROOT, DBG_LVL_ERROR, "Error!!! No file op in vroot.");
8890

@@ -142,7 +144,7 @@ FileInfo vroot_stat(const char* path)
142144

143145
if(NULL != currentAccessor)
144146
{
145-
sprintf(fullPath, "%s"PathSep"%s", cwd, path);
147+
sprintf(fullPath, "%s%s", cwd, path);
146148
return currentAccessor->stat(fullPath);
147149
}
148150

@@ -317,6 +319,7 @@ static int pathProcess_Absolute(const char* const path)
317319
{
318320
currentAccessor = &FatFSAccess;
319321
strcpy(cwd, path);
322+
strcpy(cwd + strlen(cwd), PathSep);
320323
return 0;
321324
}
322325
XBlastLogger(DEBUG_VROOT, DBG_LVL_ERROR, "Error!!! Invalid path.");

fs/ff13b/source/FatFSAccessor.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,9 +486,12 @@ FileInfo fatxstat(const char* path)
486486
{
487487
FileInfo returnStruct;
488488
FILINFO getter;
489+
FRESULT result;
489490
memset(&returnStruct, 0x00, sizeof(FileInfo));
490491
XBlastLogger(DEBUG_FATX_FS, DBG_LVL_DEBUG, "path:\"%s\"", path);
491-
if(FR_OK == f_stat(path, &getter))
492+
result = f_stat(path, &getter);
493+
XBlastLogger(DEBUG_FATX_FS, DBG_LVL_DEBUG, "result:%u", result);
494+
if(FR_OK == result)
492495
{
493496
convertToFileInfo(&returnStruct, &getter);
494497
}

0 commit comments

Comments
 (0)