This commit is contained in:
2025-11-08 11:12:16 +04:00
parent 5a6f3d323b
commit f40565c571
9 changed files with 357 additions and 14 deletions

View File

@@ -45,6 +45,15 @@ pub fn (path Path) shortpath() string {
return path.realpath().replace(os.home_dir(), '~')
}
// extension of file .
pub fn (mut path Path) ext() !string {
if path.is_file() == false {
return error('Path is not a file for getting extension: ${path.path}')
}
filext := os.file_ext(path.name()).to_lower()
return filext
}
// check the inside of pathobject, is like an init function
pub fn (mut path Path) check() {
if os.exists(path.path) {