# AE::ToolbarEditor extension registrar file
# updated 2024-08-15 for Ruby 3.x and SU2024

# Load the normal support files:
require 'sketchup.rb' unless defined?(LanguageHandler)
require 'extensions.rb' unless defined?(SketchupExtension)

# Define and load the extension's VERSION constant:
require File.join('ae_toolbareditor', 'version.rb')

module AE
  module ToolbarEditor

    unless defined?(::Fixnum)
      # Define local aliases for Integer subclasses removed in Ruby 3:
      Fixnum = ::Integer
      Bignum = ::Integer
    end

    unless ::File.respond_to?(:exists?)
      # Define method wrapper for FileTest#exists? removed in Ruby 3:
      module ::FileTest
        define_method(:exists?) { |path| self.exist?(path) }
      end
      # Define method wrapper for File::exists? removed in Ruby 3:
      class ::File
        define_singleton_method(:exists?) { |path| self.exist?(path) }
      end
    end

    # Create the extension data object:
    EXTENSION = SketchupExtension.new('ToolbarEditor', 'ae_toolbareditor/toolbareditor.rb')

    # Attach some nice info:
    EXTENSION.creator     = 'Aerilius'
    EXTENSION.version     = AE::ToolbarEditor::VERSION
    EXTENSION.copyright   = '2013-2021, Andreas Eisenbarth'
    EXTENSION.description = 'A drag&drop editor to create custom toolbars.'

    # Register and load the extension on startup.
    Sketchup.register_extension(EXTENSION, true)

  end
end
