This commit is contained in:
2025-11-09 08:20:11 +04:00
parent 5d2adb1a2c
commit 69d9949c39

View File

@@ -9,8 +9,7 @@ pub enum FileType {
pub struct File {
pub mut:
name string // name without extension
ext string // file extension
name string // name with extension
path string // relative path of file in the collection
ftype FileType // file or image
collection &Collection @[skip; str: skip] // Reference to parent collection
@@ -22,10 +21,10 @@ pub fn (mut f File) path() !pathlib.Path {
return pathlib.get_file(path: mypath, create: false)!
}
pub fn (f File) file_name() string {
return '${f.name}.${f.ext}'
}
pub fn (f File) is_image() bool {
return f.ftype == .image
}
pub fn (f File) ext() string {
return pathlib.get_file_ext(f.name)
}