Sinisterly
[Ruby] File Explorer - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Coding (https://sinister.li/Forum-Coding--71)
+--- Thread: [Ruby] File Explorer (/Thread-Ruby-File-Explorer)



[Ruby] File Explorer - Inori - 04-03-2015

Hey guys, back again.

I had a 3 hour flight coming down to Florida and instead of sleeping, I said screw it and made a few things.

This is the first version of my file explorer. Currently, it's pretty buggy and the path history is less than perfect. You're also unable to open the files inside folders currently so I'll be adding that, too.

Code:
#File explorer by Nightc||ed, ©2015 @dir = "" def search system "cls" puts "Enter directory, leaving an open end (ex; C:\\Users\\Appdata):" puts "Hit enter with a blank field to return to C:\\" if @dir != "" system "cls" puts "Current directory: #{@dir}" puts @files @dir = @dir + gets.chomp + "\\" else @dir = gets.chomp end if @dir.include?("\\\\") @dir = "C:\\" else @dir = @dir end tree = Dir.entries("#{@dir}") @files = Array.new tree.each do |sub| sub = "├#{sub}" @files << sub end puts @files search end search