implement RMD

This commit is contained in:
mtheall 2014-11-24 00:01:42 -06:00
parent 24ec52babb
commit 020f4c21df

View File

@ -2012,12 +2012,38 @@ FTP_DECLARE(RETR)
FTP_DECLARE(RMD) FTP_DECLARE(RMD)
{ {
/* TODO */ #ifdef _3DS
Result ret;
#else
int rc;
#endif
console_print("%s %s\n", __func__, args ? args : ""); console_print("%s %s\n", __func__, args ? args : "");
ftp_session_set_state(session, COMMAND_STATE); ftp_session_set_state(session, COMMAND_STATE);
return ftp_send_response(session, 502, "unavailable\r\n"); if(validate_path(args) != 0)
return ftp_send_response(session, 553, "invalid file name\r\n");
build_path(session, args);
#ifdef _3DS
ret = FSUSER_DeleteDirectory(NULL, sdmcArchive, FS_makePath(PATH_CHAR, session->buffer));
if(ret != 0)
{
console_print("FSUSER_DeleteDirectory: 0x%08X\n", (unsigned int)ret);
return ftp_send_response(session, 550, "failed to delete directory\r\n");
}
#else
rc = rmdir(session->buffer);
if(rc != 0)
{
console_print("rmdir: %s\n", strerror(errno));
return ftp_send_response(session, 550, "failed to delete directory\r\n");
}
#endif
return ftp_send_response(session, 250, "OK\r\n");
} }
FTP_DECLARE(RNFR) FTP_DECLARE(RNFR)