...
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user