File: relative_path

package info (click to toggle)
ruby-browser 2.2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 660 kB
  • ctags: 575
  • sloc: ruby: 3,447; makefile: 17
file content (27 lines) | stat: -rw-r--r-- 974 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Description: Fix relative path issue
 Tweak the file open statement to point to /usr/share/ location. The gem 
 requires these xml files to run and hence they are copied to 
 /usr/share/ruby-browser location.
Author: Balasankar C <balasankarc@autistici.org>
Forwarded: not-needed
Last-Update: 2015-05-28

---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: ruby-browser/lib/browser.rb
===================================================================
--- ruby-browser.orig/lib/browser.rb
+++ ruby-browser/lib/browser.rb
@@ -78,7 +78,11 @@ module Browser
   EMPTY_STRING = "".freeze
 
   def self.root
-    @root ||= Pathname.new(File.expand_path("../..", __FILE__))
+    if Pathname.new(File.expand_path('/usr/share/ruby-browser')).exist?
+      @root = Pathname.new(File.expand_path('/usr/share/ruby-browser'))
+    else
+      @root ||= Pathname.new(File.expand_path("../..", __FILE__))
+    end
   end
 
   # Hold the list of browser matchers.