Sha256: d91edb6e3a8172e939ccbd3dd0cf51a9803e8c8344e1fae02bf4611e1e73ae91

Contents?: true

Size: 916 Bytes

Versions: 89

Compression:

Stored size: 916 Bytes

Contents

# frozen_string_literal: true

require 'set'
require 'listen/error'

module Listen
  # @private api
  class Record
    class SymlinkDetector
      README_URL = 'https://github.com/guard/listen/blob/master/README.md'

      SYMLINK_LOOP_ERROR = <<-EOS
        ** ERROR: directory is already being watched! **

        Directory: %s

        is already being watched through: %s

        MORE INFO: #{README_URL}
      EOS

      Error = ::Listen::Error # for backward compatibility

      def initialize
        @real_dirs = Set.new
      end

      def verify_unwatched!(entry)
        real_path = entry.real_path
        @real_dirs.add?(real_path) or _fail(entry.sys_path, real_path)
      end

      private

      def _fail(symlinked, real_path)
        warn(format(SYMLINK_LOOP_ERROR, symlinked, real_path))
        raise ::Listen::Error::SymlinkLoop, 'Failed due to looped symlinks'
      end
    end
  end
end

Version data entries

89 entries across 89 versions & 6 rubygems

Version Path
harbr-0.1.90 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.89 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.88 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.87 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.86 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.85 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.84 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.83 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.82 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.81 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.80 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.79 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.78 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.77 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.76 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.75 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.74 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.73 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.72 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb
harbr-0.1.71 vendor/bundle/ruby/3.2.0/gems/listen-3.8.0/lib/listen/record/symlink_detector.rb