How to create a new file in a specific directory. I created this class:
class FileManager
def initialize()
end
def createFile(name,extension)
return File.new(name <<"."<<extension, "w+")
end
end
I would like to indicate the directory (path) where you can create the file. If this does not exist, it will be created. So what should I use fileutils, as shown here immediately after creating the file, or can I indicate directly in the creation of the place where the file will be created?
thank
source
share