fn list_dir_by_path(
        &self,
        path: String,
        filesystem_name: String,
        state_id: u8,
        token: String,
    ) -> BoxFuture<RPCResult<Result<Vec<DirItemInfo>, Errors>>> {
        let states = self.states.clone();
        Box::pin(async move {
            let states = states.lock().await;
            // Try to get the requested state
            if let Some(state) = states.get_state_by_id(state_id) {
                let state = state.lock().await;
                // Make sure the token is valid
                if state.has_token(&token) {
                    // Try to get the requested filesystem implementation
                    if let Some(filesystem) = state.get_fs_by_name(&filesystem_name) {
                        let filesystem = filesystem.lock().await;
                        let result = filesystem.list_dir_by_path(&path);
                        let result = result.await;

                        state.notify_extensions(ExtensionMessages::ListDir(
                            state_id,
                            filesystem_name,
                            path,
                            result.clone(),
                        ));

                        Ok(result)
                    } else {
                        Ok(Err(Errors::Fs(FilesystemErrors::FilesystemNotFound)))
                    }
                } else {
                    Ok(Err(Errors::BadToken))
                }
            } else {
                Ok(Err(Errors::StateNotFound))
            }
        })
    }
/// Returns the list of items inside the given directory
/// Internally implemented by the given filesystem
Returns the list of items inside the given directory
Internally implemented by the given filesystem
Returns the list of items inside the given directory Internally implemented by the given filesystem
fn list_dir_by_path(
        &self,
        path: String,
        filesystem_name: String,
        state_id: u8,
        token: String,
    ) -> BoxFuture<RPCResult<Result<Vec<DirItemInfo>, Errors>>> {
        let states = self.states.clone();
        Box::pin(async move {
            let states = states.lock().await;
            // Try to get the requested state
            if let Some(state) = states.get_state_by_id(state_id) {
                let state = state.lock().await;
                // Make sure the token is valid
                if state.has_token(&token) {
                    // Try to get the requested filesystem implementation
                    if let Some(filesystem) = state.get_fs_by_name(&filesystem_name) {
                        let filesystem = filesystem.lock().await;
                        let result = filesystem.list_dir_by_path(&path);
                        let result = result.await;
                        state.notify_extensions(ExtensionMessages::ListDir(
                            state_id,
                            filesystem_name,
                            path,
                            result.clone(),
                        ));
                        Ok(result)
                    } else {
                        Ok(Err(Errors::Fs(FilesystemErrors::FilesystemNotFound)))
                    }
                } else {
                    Ok(Err(Errors::BadToken))
                }
            } else {
                Ok(Err(Errors::StateNotFound))
            }
        })
    }
fn list_dir_by_path ( & self , path : String , filesystem_name : String , state_id : u8 , token : String , ) -> BoxFuture < RPCResult < Result < Vec < DirItemInfo > , Errors > > > { let states = self . states . clone ( ) ; Box :: pin ( async move { let states = states . lock ( ) . await ; // Try to get the requested state if let Some ( state ) = states . get_state_by_id ( state_id ) { let state = state . lock ( ) . await ; // Make sure the token is valid if state . has_token ( & token ) { // Try to get the requested filesystem implementation if let Some ( filesystem ) = state . get_fs_by_name ( & filesystem_name ) { let filesystem = filesystem . lock ( ) . await ; let result = filesystem . list_dir_by_path ( & path ) ; let result = result . await ; state . notify_extensions ( ExtensionMessages :: ListDir ( state_id , filesystem_name , path , result . clone ( ) , ) ) ; Ok ( result ) } else { Ok ( Err ( Errors :: Fs ( FilesystemErrors :: FilesystemNotFound ) ) ) } } else { Ok ( Err ( Errors :: BadToken ) ) } } else { Ok ( Err ( Errors :: StateNotFound ) ) } } ) }
Returns the list of items inside the given directory
Internally implemented by the given filesystem
Returns the list of items inside the given directory Internally implemented by the given filesystem
&self
path
String
filesystem_name
String
state_id
u8
token
String