[][src]Function transmission_sys::tr_torrentRenamePath

pub unsafe extern "C" fn tr_torrentRenamePath(
    tor: *mut tr_torrent,
    oldpath: *const c_char,
    newname: *const c_char,
    callback: tr_torrent_rename_done_func,
    callback_data: *mut c_void
)

@brief Rename a file or directory in a torrent.

@param tor the torrent whose path will be renamed @param oldpath the path to the file or folder that will be renamed @param newname the file or folder's new name @param callback the callback invoked when the renaming finishes, or NULL @param callback_data the pointer to pass in the callback's user_data arg

As a special case, renaming the root file in a torrent will also update tr_info.name.

EXAMPLES

Consider a tr_torrent where its info.files[0].name is "frobnitz-linux/checksum" and info.files[1].name is "frobnitz-linux/frobnitz.iso".

  1. tr_torrentRenamePath(tor, "frobnitz-linux", "foo") will rename the "frotbnitz-linux" folder as "foo", and update both info.name and info.files[*].name.

  2. tr_torrentRenamePath(tor, "frobnitz-linux/checksum", "foo") will rename the "frobnitz-linux/checksum" file as "foo" and update files[0].name to "frobnitz-linux/foo".

RETURN

Changing tr_info's contents requires a session lock, so this function returns asynchronously to avoid blocking. If you don't want to be notified when the function has finished, you can pass NULL as the callback arg.

On success, the callback's error argument will be 0.

If oldpath can't be found in files[].name, or if newname is already in files[].name, or contains a directory separator, or is NULL, "", ".", or "..", the error argument will be EINVAL.

If the path exists on disk but can't be renamed, the error argument will be the errno set by rename().