# Require with absolute path

**URL:** <https://www.ruby-forum.com/t/require-with-absolute-path/117795>\
**Category:** Ruby\
**Created:** [October 20, 2007, 12:03pm UTC](https://www.ruby-forum.com/t/require-with-absolute-path/117795 "2007-10-20T12:03:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![molla5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@molla5](https://www.ruby-forum.com/u/molla5)\
**Post date:** [October 20, 2007, 12:03pm UTC](https://www.ruby-forum.com/t/require-with-absolute-path/117795/1 "2007-10-20T12:03:07Z")

</div>

Hi,  
I am trying to require the xml builder library using the require  
statement as follows:

require ‘C:/builder-2.1.2/lib/builder.rb’

builder.rb in turn has two requires inside using relative paths:

require ‘builder/xmlmarkup’  
require ‘builder/xmlevents’

Althougn those files exists in the builder directory, ruby complains and  
give this error:  
require’: no such file to load – builder/xmlmarkup (LoadError)

This is strange since $: variable has “.” evertime it loads a file, so  
it should find the files in “builder” folder. What is the correct way to  
load the files in that case? put everything under ruby lib folder so  
that they are in $: ?

Regards

* * *

Do You Yahoo!?  
Tired of spam? Yahoo! Mail has the best spam protection around

> **[Yahoo Mail - Organized Email](https://mail.yahoo.com)**
>
> It's time to get stuff done with Yahoo Mail. Just add your Gmail, Outlook, AOL or Yahoo Mail to get going. We automatically organize all the things life throws at you, like receipts and attachments, so you can find what you need fast. Plus, we've got...

---

<div class="post-metadata">

**Author:** ![molla5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e0b2c6/32.png) [@molla5](https://www.ruby-forum.com/u/molla5)\
**Post date:** [October 20, 2007, 12:06pm UTC](https://www.ruby-forum.com/t/require-with-absolute-path/117795/2 "2007-10-20T12:06:37Z")

</div>

Ayhan Molla wrote:

> Althougn those files exists in the builder directory, ruby complains and give this error:  
> require’: no such file to load – builder/xmlmarkup (LoadError)
> 
> This is strange since $: variable has “.” evertime it loads a file, so it should find the files in “builder” folder. What is the correct way to load the files in that case? put everything under ruby lib folder so that they are in $: ?  
> Doesn’t the “.” refer to the cwd of the ruby process, rather than the  
> directory of the file that contains it?
