mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-14 10:33:56 -03:00
AP_Filesystem: Don't try and rename between backends
This commit is contained in:
parent
c7228419ef
commit
78d9e5a875
@ -192,8 +192,17 @@ int AP_Filesystem::mkdir(const char *pathname)
|
||||
|
||||
int AP_Filesystem::rename(const char *oldpath, const char *newpath)
|
||||
{
|
||||
const Backend &backend = backend_by_path(oldpath);
|
||||
return backend.fs.rename(oldpath, newpath);
|
||||
const Backend &oldbackend = backend_by_path(oldpath);
|
||||
|
||||
// Don't need the backend again, but we also need to remove the backend pre-fix from the new path.
|
||||
const Backend &newbackend = backend_by_path(newpath);
|
||||
|
||||
// Don't try and rename between backends.
|
||||
if (&oldbackend != &newbackend) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
return oldbackend.fs.rename(oldpath, newpath);
|
||||
}
|
||||
|
||||
AP_Filesystem::DirHandle *AP_Filesystem::opendir(const char *pathname)
|
||||
|
Loading…
Reference in New Issue
Block a user