file_to_package

Function file_to_package 

Source
pub fn file_to_package(file_path: &Path, packages_dir: &Path) -> Option<String>
Expand description

Converts a file path to its corresponding package name.

This function extracts the package name from a file path relative to the packages directory. It handles both direct file paths and paths to polykit.toml configuration files.

§Arguments

  • file_path - The file path to convert
  • packages_dir - The base packages directory

§Returns

Returns Some(package_name) if a package can be determined, None otherwise.