class FFI::LibraryPath

def full_name

def full_name
  # If the abi_number is given, we format it specifically according to platform rules:
  if abi_number
    if Platform.windows?
      "#{Platform::LIBPREFIX}#{name}-#{abi_number}.#{Platform::LIBSUFFIX}"
    elsif Platform.mac?
      "#{Platform::LIBPREFIX}#{name}.#{abi_number}.#{Platform::LIBSUFFIX}"
    else # Linux? BSD? etc.
      "#{Platform::LIBPREFIX}#{name}.#{Platform::LIBSUFFIX}.#{abi_number}"
    end
  else
    # Otherwise we just add prefix and suffix:
    lib = name
    # Add library prefix if missing
    lib = Platform::LIBPREFIX + lib unless lib =~ /^#{Platform::LIBPREFIX}/
    # Add library extension if missing
    r = Platform.windows? || Platform.mac? ? "\\.#{Platform::LIBSUFFIX}$" : "\\.so($|\\.[1234567890]+)"
    lib += ".#{Platform::LIBSUFFIX}" unless lib =~ /#{r}/
    lib
  end
end