luaur-compile-cli 0.1.3

Command-line Luau source-to-bytecode compiler (Rust).
Documentation
use alloc::string::String;

pub fn escape_filename(filename: &str) -> String {
    let mut escaped = String::with_capacity(filename.len());

    for ch in filename.bytes() {
        let c = ch as core::ffi::c_char;
        match c {
            v if v == b'\\' as core::ffi::c_char => escaped.push('/'),
            v if v == b'"' as core::ffi::c_char => {
                escaped.push('\\');
                escaped.push('"');
            }
            _ => escaped.push(ch as char),
        }
    }

    escaped
}