rootftp 0.3.1

A simple FTP server tool that allows you to play with files. Multiple users can share their files with each other. You can also build custom plugins see examples for more info.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fs;

use crate::config::Config;
use std::path::PathBuf;

pub fn load_plugin(_path: &PathBuf) {
    let config = Config::load();
    if _path.extension().and_then(|s| s.to_str()) == Some("so") {
        let plugins_dir = config.root_dir.join("plugins");
        if !plugins_dir.exists() {
            fs::create_dir_all(&plugins_dir).unwrap();
        }
        fs::copy(_path, plugins_dir.join(_path.file_name().unwrap())).unwrap();
        println!("Plugin loaded {}", _path.display());
    } else {
        println!("File is not a shared library (.so)");
    }
}