                   (new Driver @).main []
                   process.chdir oldDir
                   console.log '..', file, '(end of directory)'
-                  @maybeInit()
                   continue
                 else
                   ## Regular file
+                  @maybeInit()
                   input = inputRequire file, @settings
                   ###
                   Cache Mapping files, as we only capture `onInit` etc.

            else if input instanceof Style
              @settings.styles.push input
            else if input instanceof Drawing or input instanceof Drawings
              svgs = input.render @settings
              ## Convert to any additional formats.  Even if SVG files didn't
              ## change, we may not have done these conversions before or in the

      else
        null
  addInit: (input) ->
    @maybeInit()
    ## Now @inits == currentInits and @initsLength == currentInits.length
    @inits.push input
    @initsLength++
    input.doInit()
  maybeInit: ->
    ###
    Check whether @inits list changed and (re)initialize if so.
    If the list changed by appending items, just initialize new items.
    Otherwise, reset global `share` object (without changing object identity)
    and re-initialize all items from scratch to restore side effects.
    ###
    ## If @inits has grown without our knowledge, de-alias init lists.
    unless @initsLength == @inits.length
      @inits = @inits[...@initsLength]
    ## Cheap case: init lists are (still) identical.  Nothing to do.
    return if @inits == currentInits
    reset = (currentInits.length > @initsLength)
    unless reset
      ## currentInits is shorter or equal; check for prefix match
      for init, i in currentInits
        unless init == @inits[i]
          reset = true
          break
    if reset
      delete globalShare[key] for key of globalShare
      start = 0
    else
      start = currentInits.length
    for init in @inits[start..]
      init.doInit()
    currentInits = @inits
  main: (args = process.argv[2..]) -> runWithDriver @, =>
    @reset()
    showHelp = 'No filename arguments and no Maketile to run. Try `svgtiler --help`'
