MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / dfs_win32_unlink

Function dfs_win32_unlink

bsp/simulator/drivers/dfs_win32.c:378–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376}
377
378static int dfs_win32_unlink(struct dfs_filesystem *fs, const char *path)
379{
380 int result;
381 char *fp;
382 fp = winpath_dirdup(WIN32_DIRDISK_ROOT, path);
383 if (fp == RT_NULL)
384 {
385 rt_kprintf("out of memory.\n");
386 return -ENOMEM;
387 }
388
389 result = GetFileAttributes(fp);
390 if (result == INVALID_FILE_ATTRIBUTES)
391 goto __err;
392
393 if (result & FILE_ATTRIBUTE_DIRECTORY)//winnt.h
394 {
395 if (RemoveDirectory(fp) == RT_FALSE)
396 goto __err;
397 }
398 else //(result & FILE_ATTRIBUTE_NORMAL)
399 {
400 if (_unlink(fp) < 0)
401 goto __err;
402 }
403
404 rt_free(fp);
405 return 0;
406__err:
407 rt_free(fp);
408 return win32_result_to_dfs(GetLastError());
409}
410
411static int dfs_win32_rename(
412 struct dfs_filesystem *fs,

Callers

nothing calls this directly

Calls 4

winpath_dirdupFunction · 0.85
rt_kprintfFunction · 0.85
rt_freeFunction · 0.85
win32_result_to_dfsFunction · 0.85

Tested by

no test coverage detected