normalizefs 0.0.11

Normalization of file system paths
Documentation
/*
Normalizing of file system pathes.

Written by Radim Kolar <hsn@sendmail.cz> 2025
https://gitlab.com/hsn10/normalizefs

This is free and unencumbered software released into the public domain.
For more information, please refer to <https://unlicense.org/>

CC0: This work has been marked as dedicated to the public domain.
For more information, please refer to <https://creativecommons.org/public-domain/cc0/>

SPDX-License-Identifier: Unlicense OR CC0-1.0
*/

use std::path::Path;
use std::path::PathBuf;

pub fn path_to_vector(path: impl AsRef<Path>) -> Vec<char> {
   if let Some(x) = path.as_ref().as_os_str().to_str() {
      x.chars().collect()
   } else {
     panic!("non UTF8 support not yet implemented")
   }
}

pub fn vector_to_pathbuf(vector: Vec<char>) -> PathBuf {
   PathBuf::from(vector.into_iter().collect::<String>())
}

pub fn path_to_pathbuf(path: impl AsRef<Path>) -> PathBuf {
   PathBuf::from(path.as_ref())
}