Skip to content

Commit f2402f0

Browse files
author
Oleg Sukhodolsky
committed
Need to use realpath for breakpoints to be compatible with ruby-debug and debase
1 parent cedbc3c commit f2402f0

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/ruby-debug-ide/commands/breakpoints.rb

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'pathname' if RUBY_VERSION < '1.9'
2+
13
module Debugger
24
class AddBreakpoint < Command # :nodoc:
35
self.control = true
@@ -35,8 +37,7 @@ def execute
3537
end
3638
file = klass.name if klass
3739
else
38-
file = File.expand_path(file) if file.index(File::SEPARATOR) || \
39-
File::ALT_SEPARATOR && file.index(File::ALT_SEPARATOR)
40+
file = realpath(file)
4041
end
4142
end
4243

@@ -63,6 +64,19 @@ def help(cmd)
6364
}
6465
end
6566
end
67+
68+
private
69+
def realpath(filename)
70+
filename = File.expand_path(file) if file.index(File::SEPARATOR) || \
71+
File::ALT_SEPARATOR && file.index(File::ALT_SEPARATOR)
72+
if defined?(JRUBY_VERSION)
73+
java.io.File.new(filename).canonical_path
74+
elsif RUBY_VERSION < '1.9'
75+
File.path(Pathname.new(filename).realpath)
76+
else
77+
File.realpath(filename)
78+
end
79+
end
6680
end
6781

6882
class BreakpointsCommand < Command # :nodoc:

0 commit comments

Comments
 (0)