int fs_spiffs_rename(const char *from, const char *to) { struct mount_info *m = &s_fsm; if (!m->valid) return set_errno(EBADF); int res = SPIFFS_rename(&m->fs, (char *) from, (char *) to); if (res == SPIFFS_OK) fs_close_container(m); return set_spiffs_errno(m, res); }
int _rename_r(struct _reent *r, const char *from, const char *to) { int res = SPIFFS_rename(&fs, get_fixed_filename(from), get_fixed_filename(to)); (void) r; set_errno(res); return res; }
int _rename_r(struct _reent *r, const char *from, const char *to) { /* * POSIX rename requires that in case "to" exists, it be atomically replaced * with "from". The atomic part we can't do, but at least we can do replace. */ int res; { spiffs_stat ss; res = SPIFFS_stat(&fs, (char *) to, &ss); if (res == 0) { SPIFFS_remove(&fs, (char *) to); } } res = SPIFFS_rename(&fs, get_fixed_filename(from), get_fixed_filename(to)); (void) r; set_errno(res); return res; }
// file.rename("oldname", "newname") //==================================== static int file_rename( lua_State* L ) { size_t len; if(FILE_NOT_OPENED!=file_fd){ SPIFFS_close(&fs,file_fd); file_fd = FILE_NOT_OPENED; } const char *oldname = luaL_checklstring( L, 1, &len ); if( len > SPIFFS_OBJ_NAME_LEN ) return luaL_error(L, "filename too long"); const char *newname = luaL_checklstring( L, 2, &len ); if( len > SPIFFS_OBJ_NAME_LEN ) return luaL_error(L, "filename too long"); if(SPIFFS_OK==SPIFFS_rename(&fs, (char*)oldname, (char*)newname )){ lua_pushboolean(L, 1); } else { lua_pushboolean(L, 0); } return 1; }
int myspiffs_rename( const char *old, const char *newname ){ return SPIFFS_rename(&fs, (char *)old, (char *)newname); }
ICACHE_FLASH_ATTR int spiffs_rename(const char *oldname, const char *newname) { int res = SPIFFS_rename(&fs, (char *) oldname, (char *) newname); set_errno(res); return res; }
void fileRename(const String oldName, const String newName) { SPIFFS_rename(&_filesystemStorageHandle, oldName.c_str(), newName.c_str()); }
int _rename_r(struct _reent *r, const char *from, const char *to) { int res = SPIFFS_rename(&fs, (char *) from, (char *) to); set_errno(res); return res; }