public static function sanitizeName(string $name): string
    {
        $basename = basename($name);
        $dir = ($basename === $name) ? null : dirname($name);
        $basename = preg_replace("/[^a-zA-Z0-9-_.]/", "_", $basename);
        return ($dir === null) ? $basename : "$dir/$basename";
    }