Search code examples
rubysqlitecamping

Where does Camping store my database?


I'm building something in Camping and it occurred to me that my app's database is nowhere to be seen. It's got to be somewhere, because my data persists, but I can't find it.

Looking in source I see in server.rb:

module Camping
  class Server < Rack::Server
    class Options
      if home = ENV['HOME'] # POSIX
        DB = File.join(home, '.camping.db')
        RC = File.join(home, '.campingrc')
      elsif home = ENV['APPDATA'] # MSWIN
        DB = File.join(home, 'Camping.db')
        RC = File.join(home, 'Campingrc')
      else
        DB = nil
        RC = nil
      end

I've been trying to grep and find around my hd for something that looks like "camping.db" but i can't find anything.

I don't have a good reason to need the db file at the moment. I'm just curious. Where's the database?


Solution

  • Taking this code snippet into account and assuming that you didn't override your HOME environment variable your DB should be in ~/.camping.db (or, if you expand ~, most likely in /home/<your-username/.camping.db.

    Another thing is that as you don't use DB at the moment may it wasn't created yet. This piece of code only calculates the paths to the files, but doesn't create them.