Fixes #2623: several fixes:

Disable menu for [..],
Refresh file list after delete,
Copy destination can be a directory,
Prevent copy/paste into the same directory,
Enabled renaming of directories and files without extension,
Removed delete menu option for directories,
Several simulator filesystem functions improved
This commit is contained in:
Damjan Adamic
2015-08-17 13:40:27 +02:00
committed by Bertrand Songis
parent f5f1a052ca
commit 28b9a70e6b
3 changed files with 47 additions and 15 deletions
+18 -3
View File
@@ -929,14 +929,24 @@ FRESULT f_mkdir (const TCHAR*)
return FR_OK;
}
FRESULT f_unlink (const TCHAR*)
FRESULT f_unlink (const TCHAR* name)
{
char *path = convertSimuPath(name);
if (unlink(path)) {
TRACE("f_unlink(%s) = error %d (%s)", path, errno, strerror(errno));
return FR_INVALID_NAME;
}
TRACE("f_unlink(%s) = OK", path);
return FR_OK;
}
FRESULT f_rename(const TCHAR *oldname, const TCHAR *newname)
{
TRACE("f_rename(%s, %s)", oldname, newname);
if ( rename(oldname, newname) < 0) {
TRACE("f_rename(%s, %s) = error %d (%s)", oldname, newname, errno, strerror(errno));
return FR_INVALID_NAME;
}
TRACE("f_rename(%s, %s) = OK", oldname, newname);
return FR_OK;
}
@@ -966,7 +976,12 @@ int f_printf (FIL *fil, const TCHAR * format, ...)
FRESULT f_getcwd (TCHAR *path, UINT sz_path)
{
strcpy(path, ".");
// remove simuSdDirectory from the cwd
char * cwd = get_current_dir_name();
std::string c(cwd + strlen(simuSdDirectory));
free(cwd);
strcpy(path, c.c_str());
TRACE("f_getcwd() = %s", path);
return FR_OK;
}