# File lib/daemons/pid.rb, line 32
    def self.dir(dir_mode, dir, script)
      # nil script parameter is allowed as long as dir_mode is not :script
      return nil if dir_mode == :script && script.nil?

      case dir_mode
        when :normal
          return File.expand_path(dir)
        when :script
          return File.expand_path(File.join(File.dirname(script), dir))
        when :system
          return '/var/run'
        else
          fail Error.new("pid file mode '#{dir_mode}' not implemented")
      end
    end