I need to parse a basename in ruby a from file path which I get as input. Unix format works fine.
File.basename("/tmp/text.txt")
return "text.txt".
However, when I get input in windows format:
File.basename("C:\Users\john\note.txt")
"C:Usersjohn\note.txt" is the output.
Is there some nice solution in ruby/rails?
Aucun commentaire:
Enregistrer un commentaire