lib/eco/data/files/helpers.rb in eco-helpers-2.7.22 vs lib/eco/data/files/helpers.rb in eco-helpers-2.7.23
- old
+ new
@@ -52,22 +52,24 @@
dir_path = dir_path.gsub(File::SEPARATOR, File::ALT_SEPARATOR || File::SEPARATOR)
dir_path.split(File::ALT_SEPARATOR || File::SEPARATOR).push(file)
end
def file_name(fullname)
+ return nil unless fullname
+
File.basename(fullname)
end
def file_basename(fullname)
+ return nil unless fullname
+
File.basename(fullname, File.extname(fullname))
end
- def file_path(fullname)
- File.dirname(fullname)
- end
-
def file_fullpath(fullname)
- file_path(File.expand_path(fullname))
+ return nil unless fullname
+
+ File.dirname(File.expand_path(fullname))
end
def file_exists?(file)
return false unless file