Function deskulpt::apis::fs::utils::get_resource_path

source ยท
pub(super) fn get_resource_path<R: Runtime>(
    app_handle: &AppHandle<R>,
    widget_id: &str,
    path: &str,
) -> Result<PathBuf, String>
Expand description

Validate the file system resource (file or folder) path.

This raises an error if the widget ID is invalid, in cases where:

  • $widget_base/$widget_id does not exist
  • $widget_base/$widget_id is not a directory
  • $widget_base/$widget_id is not a direct subdirectory of $widget_base

or if the resource path is invalid, in cases where:

  • $widget_base/$widget_id/$path is not within the widget directory

Note, however, that this function does not check if the resource exists or not, since the file or folder may not exist yet, and could be created later.