Skip to main content

is_directory_writable

Function is_directory_writable 

Source
pub async fn is_directory_writable(path: &Path) -> RlgResult<bool>
Expand description

Checks if a directory is writable.

§Arguments

  • path - A reference to a Path that holds the directory path to check.

§Returns

A RlgResult<bool> which is Ok(true) if the directory is writable, Ok(false) otherwise, or an error if the operation fails.

§Errors

This function returns an error if the temporary file used for testing writability cannot be removed.

§Examples

use rlg::utils::is_directory_writable;
use std::path::Path;

#[tokio::main]
async fn main() -> rlg::error::RlgResult<()> {
    let path = Path::new(".");
    let is_writable = is_directory_writable(&path).await?;
    println!("Is directory writable: {}", is_writable);
    Ok(())
}