# Shoes and require

**URL:** <https://www.ruby-forum.com/t/shoes-and-require/135623>\
**Category:** Ruby\
**Created:** [April 23, 2008, 5:59pm UTC](https://www.ruby-forum.com/t/shoes-and-require/135623 "2008-04-23T17:59:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![adler24](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@adler24](https://www.ruby-forum.com/u/adler24)\
**Post date:** [April 23, 2008, 5:59pm UTC](https://www.ruby-forum.com/t/shoes-and-require/135623/1 "2008-04-23T17:59:36Z")

</div>

Helo

I’m playing a little bit around with shoes.  
Their i have a problem with require. When i want to require a file witch  
is in the same Directory like the Shoes.app File i get a “no such file  
to load error”. Is it not possible to require files?

shoesTest.rb:  
require “shoesTestb”

Shoes.app do  
$app = self  
para “lalala”  
para lala  
end

shoesTestb.rb:  
def lala  
‘lalafunction’  
end

---

<div class="post-metadata">

**Author:** ![adler24](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@adler24](https://www.ruby-forum.com/u/adler24)\
**Post date:** [April 23, 2008, 6:10pm UTC](https://www.ruby-forum.com/t/shoes-and-require/135623/2 "2008-04-23T18:10:31Z")

</div>

> Their i have a problem with require. When i want to require a  
> para lala  
> end
> 
> shoesTestb.rb:  
> def lala  
> ‘lalafunction’  
> end

Apparently, your current directory is not the same as where your files  
are and you are invoking your application by path. If so, you need to do  
the following before ‘require’:

$: \<\< File.dirname( **FILE** )

Gennady.

---

<div class="post-metadata">

**Author:** ![adler24](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@adler24](https://www.ruby-forum.com/u/adler24)\
**Post date:** [April 23, 2008, 7:20pm UTC](https://www.ruby-forum.com/t/shoes-and-require/135623/3 "2008-04-23T19:20:53Z")

</div>

On Thu, Apr 24, 2008 at 01:09:44AM +0900, Gennady B. wrote:

> Apparently, your current directory is not the same as where your files  
> are and you are invoking your application by path. If so, you need to  
> do the following before ‘require’:
> 
> $: \<\< File.dirname( **FILE** )

If you’re using 1.9, then:

require ‘require\_relative’  
require\_relative(‘feature’)

> On Thu, Apr 24, 2008 at 12:59:37AM +0900, Asdf Fsda wrote:
> 
> > is in the same Directory like the Shoes.app File i get a “no such file  
> > to load error”. Is it not possible to require files?

The require method doesn’t take a filename as a parameter; it takes a  
“feature name”. Changing my thinking to this paradigm has saved me from  
being frustrated with Ruby for not working the way I expect.

Paul

---

<div class="post-metadata">

**Author:** ![adler24](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@adler24](https://www.ruby-forum.com/u/adler24)\
**Post date:** [April 24, 2008, 10:24am UTC](https://www.ruby-forum.com/t/shoes-and-require/135623/4 "2008-04-24T10:24:35Z")

</div>

Paul B. wrote:

> On Thu, Apr 24, 2008 at 01:09:44AM +0900, Gennady B. wrote:
> 
> > Apparently, your current directory is not the same as where your files  
> > are and you are invoking your application by path. If so, you need to  
> > do the following before ‘require’:
> > 
> > $: \<\< File.dirname( **FILE** )

**FILE** #=\> (eval)  
So that doesent work

> If you’re using 1.9, then:

Shoes is using 1.8.6

> > On Thu, Apr 24, 2008 at 12:59:37AM +0900, Asdf Fsda wrote:
> > 
> > > is in the same Directory like the Shoes.app File i get a “no such file  
> > > to load error”. Is it not possible to require files?
> 
> The require method doesn’t take a filename as a parameter; it takes a  
> “feature name”. Changing my thinking to this paradigm has saved me from  
> being frustrated with Ruby for not working the way I expect.  
> My problem is that Shoes is not working the way I expect 😉

Fabian

---

<div class="post-metadata">

**Author:** ![adler24](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@adler24](https://www.ruby-forum.com/u/adler24)\
**Post date:** [April 26, 2008, 12:51am UTC](https://www.ruby-forum.com/t/shoes-and-require/135623/5 "2008-04-26T00:51:19Z")

</div>

\_why wrote:

> On Thu, Apr 24, 2008 at 05:24:36PM +0900, Asdf Fsda wrote:
> 
> > Paul B. wrote:
> > 
> > > On Thu, Apr 24, 2008 at 01:09:44AM +0900, Gennady B. wrote:
> > > 
> > > > Apparently, your current directory is not the same as where your files  
> > > > are and you are invoking your application by path. If so, you need to  
> > > > do the following before ‘require’:
> > > > 
> > > > $: \<\< File.dirname( **FILE** )
> > 
> > **FILE** #=\> (eval)  
> > So that doesent work
> 
> Try the more recent 0.r532 builds. Not only should require work,  
> but $0 and **FILE** should be set right.
> 
> [https://code.whytheluckystiff.net/shoes/wiki/RecentBuilds](https://code.whytheluckystiff.net/shoes/wiki/RecentBuilds)

Thank you for the Tipp  
I downloaded shoes-0.r532-intel.dmg tried to start it on OS X 10.5.2 on  
an MacBook.  
I get this Error: LSOpenFromURLSpec() failed with error -10810 for the  
file /Users/fabian.  
What can this be?

Fabian

---

<div class="post-metadata">

**Author:** ![adler24](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/ee59a6/32.png) [@adler24](https://www.ruby-forum.com/u/adler24)\
**Post date:** [April 25, 2008, 5:42pm UTC](https://www.ruby-forum.com/t/shoes-and-require/135623/6 "2008-04-25T17:42:14Z")

</div>

On Thu, Apr 24, 2008 at 05:24:36PM +0900, Asdf Fsda wrote:

> Paul B. wrote:
> 
> > On Thu, Apr 24, 2008 at 01:09:44AM +0900, Gennady B. wrote:
> > 
> > > Apparently, your current directory is not the same as where your files  
> > > are and you are invoking your application by path. If so, you need to  
> > > do the following before ‘require’:
> > > 
> > > $: \<\< File.dirname( **FILE** )
> 
> **FILE** #=\> (eval)  
> So that doesent work

Try the more recent 0.r532 builds. Not only should require work,  
but $0 and **FILE** should be set right.

[https://code.whytheluckystiff.net/shoes/wiki/RecentBuilds](https://code.whytheluckystiff.net/shoes/wiki/RecentBuilds)

My apologies.

\_why
