From: Bill R. <ro...@gm...> - 2012-02-22 06:03:25
|
On 2012-02-22, at 1:07 , Stefan Frey wrote: > What would you think about adding a default directory to store rails > application data and settings. Something like ~/.rails on a Unix system. > The major advantage would be that the settings would survive new > releases without providing an installer that searches for the > application data. ... > Another question is how does this work on a Mac system? As the Mac OS is > built on a BSD I would assume that the Unix way of things should work, > but is that true? In order to be difficult, Mac OS provides at least three places to store this data. The defaults are: ~/Library/Preferences/org.rails.rails for 'preferences', like the size and position of windows. ~/Library/Rails for 'irreplacable' user data: I am not sure that Rails has any such data ~/Library/Application Support/Rails for 'nonessential' user data like templates, plugins, etc. In practice, most apps store small preference files in ~/Library/Preferences and larger pieces of data in ~/Library/Application Support. Finding the user's home directory can be done with System.getProperty("user.home"), or at least this is what the docs say, and it seems to be appropriate to hardcode the rest of the chosen path. All of this information comes from https://developer.apple.com/library/mac/#qa/qa1170/_index.html . Many mac programs do just follow the Unix way and throw things into, for example, ~/.rails , but this behaviour is somewhat inappropriate and can confuse users who are not happy with the command line, which is pretty much the only way to access these directories. Programs that do things like this are usually things like ssh, git, and emacs, which can usually assume that their users are somewhat sophisticated. Bill |