new file: README.md~
new file: c/ff~ modified: c/main.rb renamed: c/ff -> fichier/ff new file: fichier/index.html modified: m/ReadFile.rb new file: m/ReadFolder.rb
This commit is contained in:
@ -2,6 +2,8 @@ class ReadFile
|
||||
def initialize(pFic)
|
||||
@fic = File.open(pFic, "r")
|
||||
end
|
||||
|
||||
|
||||
|
||||
def getALL
|
||||
all = @fic.read
|
||||
@ -15,6 +17,6 @@ class ReadFile
|
||||
end
|
||||
end
|
||||
|
||||
class TestLink
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
21
m/ReadFolder.rb
Normal file
21
m/ReadFolder.rb
Normal file
@ -0,0 +1,21 @@
|
||||
class String
|
||||
def liste_rep(espacement = "")
|
||||
|
||||
liste_exclus = [".", ".."]
|
||||
d = Dir.open(self)
|
||||
|
||||
liste_dir = d.sort - liste_exclus
|
||||
|
||||
liste_dir.each { |fichier|
|
||||
case File.ftype(self+fichier)
|
||||
when "directory"
|
||||
puts "#{espacement} + #{fichier}/"
|
||||
espacement += " "
|
||||
(self + fichier + "/").liste_rep(espacement)
|
||||
espacement = espacement[0, espacement.length-4]
|
||||
when "file"
|
||||
puts "#{espacement} - #{fichier}"
|
||||
end
|
||||
}
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user