summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/epspdf/epspdfboot.rb
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/epspdf/epspdfboot.rb')
-rw-r--r--Master/texmf-dist/scripts/epspdf/epspdfboot.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/epspdf/epspdfboot.rb b/Master/texmf-dist/scripts/epspdf/epspdfboot.rb
new file mode 100644
index 00000000000..bdcebb77b26
--- /dev/null
+++ b/Master/texmf-dist/scripts/epspdf/epspdfboot.rb
@@ -0,0 +1,40 @@
+# Manipulate library path and maybe search path.
+
+# Problem to be solved:
+
+# We don't want to require Windows users to install Ruby and Tcl/Tk so
+# we offer a package with a built-in Ruby subset. This subset is
+# slightly modified from the subset created by rubyscript2exe
+# (http://www.erikveen.dds.nl/rubyscript2exe/).
+
+# The rubyscript2exe directory structure is simplified compared to the
+# original Ruby directory structure, so we need to modify the library
+# search path and also the general search path.
+
+# Assumptions:
+
+# - The script itself is at the root or in a toplevel subdirectory.
+# - If an rbconfig.rb is found at the root or in
+# a toplevel directory then there is a Ruby subset.
+# If that is the Ruby which is used
+# then it needs help to find its files.
+
+dir = File.expand_path( File.dirname( __FILE__ ) )
+parent = File.dirname( dir )
+parent_sl = parent.dup + ( parent =~ /[\\\/]$/ ? '' : '/' )
+dir_sl = dir.dup + ( parent =~ /[\\\/]$/ ? '' : '/' )
+spath = ENV['PATH'].dup
+
+if test( ?e, parent_sl + 'lib/rbconfig.rb' )
+ root_sl = parent_sl
+elsif test( ?e, dir_sl + 'lib/rbconfig.rb' )
+ root_sl = dir_sl
+else
+ root_sl = nil
+end
+
+if root_sl
+ $: << "#{root_sl}lib"
+end
+
+$:.unshift( dir )