lib/ld/file/file.rb in ld-0.3.2 vs lib/ld/file/file.rb in ld-0.3.3
- old
+ new
@@ -1,17 +1,26 @@
class Ld::File
attr_accessor :path, :base_name, :name, :type
def initialize path
+ # raise "file is not found!\n#{path}" if !File.exist? path
@path = path
@name = File.basename @path
@base_name = name.split('.')[0]
@type = File.directory?(@path) ? 1 : 0
end
def self.open_dir path
Ld::File.new path
+ end
+
+ def self.open path
+ if File.exist? path
+ self.new path
+ else
+ return nil
+ end
end
def brothers
father.children
end