f_mkdir:


1 /*-----------------------------------------------------------------------*/ 2 /* Create a Directory */ 3 /*-----------------------------------------------------------------------*/ 4 5 FRESULT f_mkdir ( 6 const TCHAR *path /* Pointer to the directory path */ 7 ) 8 { 9 FRESULT res; 10 DIR dj; 11 BYTE *dir, n; 12 DWORD dsc, dcl, pcl, tim = get_fattime(); 13 DEF_NAMEBUF; 14 15 16 res = chk_mounted(&path, &dj.fs, 1); 17 if (res == FR_OK) { 18 INIT_BUF(dj); 19 res = follow_path(&dj, path); /* Follow the file path */ 20 if (res == FR_OK) res = FR_EXIST; /* Any object with same name is already existing */ 21 if (_FS_RPATH && res == FR_NO_FILE && (dj.fn[NS] & NS_DOT)) 22 res = FR_INVALID_NAME; 23 if (res == FR_NO_FILE) { /* Can create a new directory */ 24 dcl = create_chain(dj.fs, 0); /* Allocate a cluster for the new directory table */ 25 res = FR_OK; 26 if (dcl == 0) res = FR_DENIED; /* No space to allocate a new cluster */ 27 if (dcl == 1) res = FR_INT_ERR; 28 if (dcl ==