@@ -115,7 +115,7 @@ void FileManager::addRestAPIEndpoints(RestAPIEndpointManager& endpointManager)
115115// Format file system
116116// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
117117
118- void FileManager::apiReformatFS (const String &reqStr, String& respStr, const APISourceInfo& sourceInfo)
118+ RaftRetCode FileManager::apiReformatFS (const String &reqStr, String& respStr, const APISourceInfo& sourceInfo)
119119{
120120 // File system
121121 String fileSystemStr = RestAPIEndpointManager::getNthArgStr (reqStr.c_str (), 1 );
@@ -128,6 +128,7 @@ void FileManager::apiReformatFS(const String &reqStr, String& respStr, const API
128128 if (pSysMan)
129129 pSysMan->systemRestart ();
130130 }
131+ return RaftRetCode::RAFT_RET_OK ;
131132}
132133
133134// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -136,7 +137,7 @@ void FileManager::apiReformatFS(const String &reqStr, String& respStr, const API
136137// The second part of the path is the folder - note that / must be replaced with ~ in folder
137138// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
138139
139- void FileManager::apiFileList (const String &reqStr, String& respStr, const APISourceInfo& sourceInfo)
140+ RaftRetCode FileManager::apiFileList (const String &reqStr, String& respStr, const APISourceInfo& sourceInfo)
140141{
141142 // File system
142143 String fileSystemStr = RestAPIEndpointManager::getNthArgStr (reqStr.c_str (), 1 );
@@ -158,6 +159,7 @@ void FileManager::apiFileList(const String &reqStr, String& respStr, const APISo
158159#ifdef DEBUG_FILE_MANAGER_FILE_LIST_DETAIL
159160 LOG_W (MODULE_PREFIX , " apiFileList respStr %s" , respStr.c_str ());
160161#endif
162+ return RaftRetCode::RAFT_RET_OK ;
161163}
162164
163165// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -166,7 +168,7 @@ void FileManager::apiFileList(const String &reqStr, String& respStr, const APISo
166168// The second part of the path is the folder and filename - note that / must be replaced with ~ in folder
167169// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
168170
169- void FileManager::apiFileRead (const String &reqStr, String& respStr, const APISourceInfo& sourceInfo)
171+ RaftRetCode FileManager::apiFileRead (const String &reqStr, String& respStr, const APISourceInfo& sourceInfo)
170172{
171173 // File system
172174 String fileSystemStr = RestAPIEndpointManager::getNthArgStr (reqStr.c_str (), 1 );
@@ -180,10 +182,11 @@ void FileManager::apiFileRead(const String &reqStr, String& respStr, const APISo
180182 if (!pFileContents)
181183 {
182184 respStr = " " ;
183- return ;
185+ return RaftRetCode:: RAFT_RET_CANNOT_START ;
184186 }
185187 respStr = pFileContents;
186188 free (pFileContents);
189+ return RaftRetCode::RAFT_RET_OK ;
187190}
188191
189192// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -192,7 +195,7 @@ void FileManager::apiFileRead(const String &reqStr, String& respStr, const APISo
192195// The second part of the path is the filename - note that / must be replaced with ~ in filename
193196// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
194197
195- void FileManager::apiDeleteFile (const String &reqStr, String& respStr, const APISourceInfo& sourceInfo)
198+ RaftRetCode FileManager::apiDeleteFile (const String &reqStr, String& respStr, const APISourceInfo& sourceInfo)
196199{
197200 // File system
198201 String fileSystemStr = RestAPIEndpointManager::getNthArgStr (reqStr.c_str (), 1 );
@@ -205,34 +208,34 @@ void FileManager::apiDeleteFile(const String &reqStr, String& respStr, const API
205208 filenameStr.replace (" ~" , " /" );
206209 if (filenameStr.length () != 0 )
207210 rslt = fileSystem.deleteFile (fileSystemStr, filenameStr);
208- Raft::setJsonBoolResult (reqStr.c_str (), respStr, rslt);
209211 LOG_I (MODULE_PREFIX , " deleteFile reqStr %s fs %s, filename %s rslt %s" ,
210212 reqStr.c_str (), fileSystemStr.c_str (), filenameStr.c_str (),
211213 rslt ? " ok" : " fail" );
214+ return Raft::setJsonBoolResult (reqStr.c_str (), respStr, rslt);
212215}
213216
214217// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
215218// Upload file to file system - completed
216219// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
217220
218- void FileManager::apiUploadFileComplete (const String &reqStr, String &respStr, const APISourceInfo& sourceInfo)
221+ RaftRetCode FileManager::apiUploadFileComplete (const String &reqStr, String &respStr, const APISourceInfo& sourceInfo)
219222{
220223#ifdef DEBUG_FILE_MANAGER_UPLOAD
221224 LOG_I (MODULE_PREFIX , " uploadFileComplete %s" , reqStr.c_str ());
222225#endif
223- Raft::setJsonBoolResult (reqStr.c_str (), respStr, true );
226+ return Raft::setJsonBoolResult (reqStr.c_str (), respStr, true );
224227}
225228
226229// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
227230// Upload file to file system - part of file
228231// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
229232
230- RaftRetCode::RetCode FileManager::apiUploadFileBlock (const String& req, FileStreamBlock& fileStreamBlock, const APISourceInfo& sourceInfo)
233+ RaftRetCode FileManager::apiUploadFileBlock (const String& req, FileStreamBlock& fileStreamBlock, const APISourceInfo& sourceInfo)
231234{
232235 if (_pProtocolExchange)
233236 return _pProtocolExchange->handleFileUploadBlock (req, fileStreamBlock, sourceInfo,
234237 FileStreamBase::FILE_STREAM_CONTENT_TYPE_FILE , " " );
235- return RaftRetCode::INVALID_OPERATION ;
238+ return RaftRetCode::RAFT_RET_INVALID_OPERATION ;
236239}
237240
238241// /////////////////////////////////////////////////////////////////////////////////////////////////////////////////
0 commit comments