FSEntry_Rename()

void  FSEntry_Rename (CPU_CHAR     *name_full_old,
                      CPU_CHAR     *name_full_new,
                      CPU_BOOLEAN   excl,
                      FS_ERR       *p_err);

File

Called from

Code enabled by

fs_entry.c

Application;
fs_rename()

not FS_CFG_RD_ONLY_EN

Rename a file or directory.

See also fs_rename().

Arguments

name_full_old

Old path of the entry. See the sub-topic "µC/FS File and Directory Names and Paths" in the topic Useful Information.

name_full_new

New path of the entry.

excl

Indicates whether the creation of the new entry shall be exclusive (see Note #1):

DEF_YES, if the entry shall be renamed only if name_full_new does not exist.

DEF_NO, if the entry shall be renamed even if name_full_new does exist.

p_err

Pointer to variable that will the receive return error code from this function:

FS_ERR_NONE

File copied successfully.

FS_ERR_NAME_NULL

Argument name_full_old or name_full_new passed a NULL pointer.

FS_ERR_NAME_INVALID

Entry name specified invalid OR volume could not be found.

FS_ERR_NAME_PATH_TOO_LONG

Entry name specified too long.

FS_ERR_VOL_NOT_OPEN

Volume was not open.

FS_ERR_VOL_NOT_MOUNTED

Volume was not mounted.

FS_ERR_BUF_NONE_AVAIL

Buffer not available.

FS_ERR_DEV

Device access error.

Returned Value

None.

Notes/Warnings

  1. If name_full_old and name_full_new specify entries on different volumes, then name_full_old must specify a file. If name_full_old specifies a directory, an error will be returned.
  2. If name_full_old and name_full_new specify the same entry, the volume will not be modified and no error will be returned.
  3. If name_full_old specifies a file:
    1. name_full_new must not specify a directory;
    2. if excl is DEF_NO and name_full_new is a file, it will be removed.
  4. If name_full_old specifies a directory:
    1. name_full_new must not specify a file
    2. if excl is DEF_NO and name_full_new is a directory, name_full_newmust be empty; if so, it will be removed.
  5. If excl is DEF_NO, name_full_new must not exist.
  6. The root directory may not be renamed.