on_rename Event

Fires when the OS wants to rename or move a file or directory within the virtual filesystem.

Syntax

class FUSERenameEventParams(object):
  @property
  def old_path() -> str: ...
  @property
  def new_path() -> str: ...
  @property
  def flags() -> int: ...
  @property
  def result() -> int: ...
  @result.setter
  def result(value) -> None: ...

# In class FUSE:
@property
def on_rename() -> Callable[[FUSERenameEventParams], None]: ...
@on_rename.setter
def on_rename(event_hook: Callable[[FUSERenameEventParams], None]) -> None: ...

Remarks

This event fires when the OS wants to rename or move the specified file or directory from OldPath to NewPath, both of which are fully-qualified and located in the virtual filesystem. The Flags parameter is currently not used.

To handle this event properly, applications must perform any actions needed to rename or move the specified file or directory in their backend storage, overwriting the destination file if necessary. An application may also, for its own reasons, decide not to overwrite a destination file, in which case it must deny the operation by returning an appropriate error code via ResultCode.

Windows:

This event only fires if a file or directory with the specified NewPath does not exist; or if such a file does exist, and an overwrite was requested. Cases where a file with the specified NewPath exists, and an overwrite was not requested, are handled by the class internally. (Note that Windows only allows files to be overwritten, and denies a rename or move request automatically if the destination is an existing directory.)

Any handles to the file being renamed are closed before the rename operation and re-opened after the operation. If the rename operation fails, then the file handles are re-opened using the old name. If any of re-open operations fail, the re-opening process is stopped, and any handles that have been re-opened already are closed again.

In any case, the value returned by the application in the ResultCode parameter is passed back to the system.

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a negative error code value (e.g. -ENOENT to indicate that the file does not exist) to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.

 
 
Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS FUSE 2020 Python Edition - Version 20.0 [Build 7836]