Select one of the symbols to view example projects that use it.
 
Outline
Includes
#include "filebrowser_app.h"
#include <string.h>
FILEMGR_ParseDisks(char *, FILELIST_FileTypeDef *)
FILEMGR_GetParentDir(char *)
FILEMGR_GetFileOnly(char *, char *)
Files
loading...
CodeScopeSTM32 Libraries and SamplesMB1063Modules/filebrowser/filebrowser_app.c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
/** ****************************************************************************** * @file filebrowser_app.c * @author MCD Application Team * @brief Utilities for file handling ****************************************************************************** * @attention * * Copyright (c) 2017 STMicroelectronics. * All rights reserved. * * This software is licensed under terms that can be found in the LICENSE file * in the root directory of this software component. * If no LICENSE file comes with this software, it is provided AS-IS. * ****************************************************************************** *//* ... */ /* Includes ------------------------------------------------------------------*/ #include "filebrowser_app.h" #include <string.h> /** @addtogroup FILE_BROWSER_MODULE * @{ *//* ... */ /** @defgroup FILE_BROWSER * @brief file browser routines * @{ *//* ... */ Includes /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /** * @brief Copy disk content in the explorer list * @param path: pointer to root path * @param list: pointer to file list * @retval Status *//* ... */ uint8_t FILEMGR_ParseDisks (char *path, FILELIST_FileTypeDef *list) { FRESULT res; FILINFO fno; DIR dir; char *fn; res = f_opendir(&dir, path); list->ptr = 0; if (res == FR_OK) { while (1) { res = f_readdir(&dir, &fno); if (res != FR_OK || fno.fname[0] == 0) { break; }if (res != FR_OK || fno.fname[0] == 0) { ... } if (fno.fname[0] == '.') { continue; }if (fno.fname[0] == '.') { ... } fn = fno.fname; if (list->ptr < FILEMGR_LIST_DEPDTH) { if ((fno.fattrib & AM_DIR) == AM_DIR) { strncpy((char *)list->file[list->ptr].name, (char *)fn, FILEMGR_FILE_NAME_SIZE); list->file[list->ptr].type = FILETYPE_DIR; list->ptr++; }if ((fno.fattrib & AM_DIR) == AM_DIR) { ... } else { strncpy((char *)list->file[list->ptr].name, (char *)fn, FILEMGR_FILE_NAME_SIZE); list->file[list->ptr].type = FILETYPE_FILE; list->ptr++; }else { ... } }if (list->ptr < FILEMGR_LIST_DEPDTH) { ... } }while (1) { ... } }if (res == FR_OK) { ... } f_closedir(&dir); return res; }{ ... } /** * @brief Retrieve the parent directory from full file path * @param dir: pointer to parent directory * @retval None *//* ... */ void FILEMGR_GetParentDir (char *dir) { uint16_t idx = FILEMGR_FULL_PATH_SIZE; for ( ; idx > 0; idx --) { if (dir [idx] == '/') { dir [idx + 1] = 0; break; }if (dir [idx] == '/') { ... } dir [idx + 1] = 0; }for (; idx > 0; idx --) { ... } }{ ... } /** * @brief Retrieve the file name from a full file path * @param file: pointer to base path * @param path: pointer to full path * @retval None *//* ... */ void FILEMGR_GetFileOnly (char *file, char *path) { char *baseName1, *baseName2; baseName1 = strrchr(path,'/'); baseName2 = strrchr(path,':'); if(baseName1++) { strcpy(file, baseName1); }if (baseName1++) { ... } else { if (baseName2++) { strcpy(file, baseName2); }if (baseName2++) { ... } else { strcpy(file, path); }else { ... } }else { ... } }{ ... } /** * @} *//* ... */ /** * @} *//* ... */