0

I'm learning Ruby, and i'm actually coding an app that would create playlists.

Once created, I would like to generate an output file (XSPF, which is a standard) in a custom directory (eg. my 'home' folder) and was wondering where I should define the output folder for those files.

I guess it is in the config folder, but where ? Also, how will I call it in my script afterwards ?

Thanks !

gordie
  • 1,637
  • 3
  • 21
  • 41
  • What kind of files? Are they temporary? `tmp`. Are they something you want put into your version control system or not? Are they used after they're generated? Are they accessed by visitors to the site directly? – tadman Feb 26 '20 at 17:01
  • 1
    So believe it or not, generating persistent files in your directory is _not_ something that's commonly done. Why? Because most apps these days are deployed to ephemeral environments, which means that your codebase will get reset to its original state each time you deploy. So I would advise to either use a cloud storage provider such as S3, or use tempfiles – max pleaner Feb 26 '20 at 17:02
  • @max pleaner : what if you build a small little local app for your own use only ? – gordie Feb 26 '20 at 17:39
  • @gordie well, you can use `File` to write files - see https://stackoverflow.com/questions/2777802/how-to-write-to-file-in-ruby ... in terms of where you write the files, that's your decision. Probably I would advise making some standalone folder for them. However if you want them to be publicly available put them in `public`. – max pleaner Feb 26 '20 at 18:12

0 Answers0