class Sicily::Util::FileUtil

Public Class Methods

eval_dest_path(src_path, dest_path) click to toggle source
# File lib/sicily/util/file_util.rb, line 16
def self.eval_dest_path(src_path, dest_path)
  time = extract_time(src_path)
  time.strftime(dest_path)
end
extract_time(path) click to toggle source
# File lib/sicily/util/file_util.rb, line 21
def self.extract_time(path)
  exif_time = jpeg?(path) && ExifUtil.extract_time_from_jpeg(path)
  exif_time || extract_time_from_file_stat(path)
end
extract_time_from_file_stat(path) click to toggle source
# File lib/sicily/util/file_util.rb, line 30
def self.extract_time_from_file_stat(path)
  File.birthtime(path)
rescue NotImplementedError
  File.mtime(path)
end
jpeg?(path) click to toggle source
# File lib/sicily/util/file_util.rb, line 26
def self.jpeg?(path)
  %w[.jpg .jpeg].include? File.extname(path).downcase
end