X-Git-Url: http://gitweb.michael.orlitzky.com/?p=mailshears.git;a=blobdiff_plain;f=lib%2Fcommon%2Ffilesystem.rb;fp=lib%2Fcommon%2Ffilesystem.rb;h=72ff901dd1e0dc602369c6a795a13d0164ab30d5;hp=0000000000000000000000000000000000000000;hb=c6cab6b71770d14dad1115db90a00b990c44a58d;hpb=150ee5398c17acca8ef03b3cc48b3aa7bc1b0035 diff --git a/lib/common/filesystem.rb b/lib/common/filesystem.rb new file mode 100644 index 0000000..72ff901 --- /dev/null +++ b/lib/common/filesystem.rb @@ -0,0 +1,22 @@ +class Filesystem + + def self.begins_with_dot(path) + return (path[0..0] == '.') + end + + def self.get_subdirs(dir) + subdirs = [] + + Dir.open(dir) do |d| + d.each do |entry| + relative_path = File.join(dir, entry) + if (File.directory?(relative_path) and not begins_with_dot(entry)) + subdirs << entry + end + end + end + + return subdirs + end + +end