add and apply util method is_interesting_file

This commit is contained in:
Leeingnyo
2021-01-26 04:14:17 +09:00
parent c51cb28df2
commit 2b0cf41336
3 changed files with 13 additions and 6 deletions
+3 -1
View File
@@ -1,3 +1,5 @@
require "./util"
class File
abstract struct Info
def inode
@@ -11,7 +13,7 @@ class File
# ensures that moving (unless to another device) and renaming the file
# preserves the signature, while copying or editing the file changes it.
def self.signature(filename) : UInt64
return 0u64 unless %w(.zip .rar .cbz .cbr).includes? File.extname filename
return 0u64 unless is_interesting_file filename
info = File.info filename
signatures = [
info.inode,