예제 #1
0
/*Function:
  SYS_FS_HANDLE SYS_FS_FileOpen_Wrapper(const char *fname,
                                 SYS_FS_FILE_OPEN_ATTRIBUTES attributes);

***************************************************************************/
SYS_FS_RESULT SYS_FS_Unmount_Wrapper(const char *fname)
{
    char localSitePath[SYS_FS_MAX_PATH + 1];
    const char *fnameBuf = SYS_FS_FileNameFormat(fname, localSitePath, sizeof(localSitePath));

    return (fnameBuf == 0) ? SYS_FS_RES_FAILURE : SYS_FS_Unmount(fnameBuf);
}
예제 #2
0
/*Function:
  SYS_FS_HANDLE SYS_FS_FileOpen_Wrapper(const char *fname,
                                 SYS_FS_FILE_OPEN_ATTRIBUTES attributes);

***************************************************************************/
SYS_FS_RESULT SYS_FS_Unmount_Wrapper(const char *fname)
{
    uint32_t compareResult, strCopyLoop;
    SYS_FS_HANDLE fileStatResult;
    uint8_t localSitePath[14];
    uint8_t fnameString[WEBSITE_PATH_LENGTH];
    const char *fnameBuf;

    for (strCopyLoop=0; strCopyLoop <WEBSITE_PATH_LENGTH; strCopyLoop++)
        fnameString[strCopyLoop] = 0;

    for (strCopyLoop=0; strCopyLoop <WEBSITE_PATH_LENGTH+12; strCopyLoop++)
        localSitePath[strCopyLoop] = 0;

    fnameBuf = fname;

    /* Copy fname into a string */
    for (strCopyLoop=0; strCopyLoop <WEBSITE_PATH_LENGTH; fnameBuf++, strCopyLoop++)
        fnameString[strCopyLoop] = *fnameBuf;

    /* Copy the local website path to to a string*/
    strncpy((char*)localSitePath,(const char*)LOCAL_WEBSITE_PATH, strlen((const char*)LOCAL_WEBSITE_PATH));

    /* Check web path name to see if it already contains local website name*/
    compareResult = strncmp((const char *)fnameString,(const char *)localSitePath,strlen((char *)localSitePath));

    /* If it does*/
    if (compareResult == 0)
    {
        /* Pass the fname directly to the FileOpen function*/
        fileStatResult = SYS_FS_Unmount(fname);
    }
    /* If not*/
    else
    {
        /*Append local path to web path*/
         strncat((char*)localSitePath,(const char*)fname,WEBSITE_PATH_LENGTH+12);
        fileStatResult = SYS_FS_Unmount((const char *)localSitePath);
    }

    return fileStatResult;
}