defer file.Close()
content := helpers.ReaderToBytes(file)
- format := metadecoders.FormatFromString(f.Extension())
+ format := metadecoders.FormatFromString(f.Ext())
return metadecoders.Default.Unmarshal(content, format)
}
// The directory is relative to the content root.
Dir() string
- // Extension gets the file extension, i.e "myblogpost.md" will return "md".
+ // Extension is an alias to Ext().
+ // Deprecated: Use Ext instead.
Extension() string
- // Ext is an alias for Extension.
- Ext() string // Hmm... Deprecate Extension
+ // Ext gets the file extension, i.e "myblogpost.md" will return "md".
+ Ext() string
// LogicalName is filename and extension of the file.
LogicalName() string
func (fi *FileInfo) Dir() string { return fi.relDir }
// Extension is an alias to Ext().
-func (fi *FileInfo) Extension() string { return fi.Ext() }
+func (fi *FileInfo) Extension() string {
+ helpers.Deprecated(".File.Extension", "Use .File.Ext instead. ", false)
+ return fi.Ext()
+}
// Ext returns a file's extension without the leading period (ie. "md").
func (fi *FileInfo) Ext() string { return fi.ext }