# Setup.rb and shared data

**URL:** <https://www.ruby-forum.com/t/setup-rb-and-shared-data/113546>\
**Category:** Ruby\
**Created:** [September 1, 2007, 2:38pm UTC](https://www.ruby-forum.com/t/setup-rb-and-shared-data/113546 "2007-09-01T14:38:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![apeiros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/838e76/32.png) [@apeiros](https://www.ruby-forum.com/u/apeiros)\
**Post date:** [September 1, 2007, 2:38pm UTC](https://www.ruby-forum.com/t/setup-rb-and-shared-data/113546/1 "2007-09-01T14:38:02Z")

</div>

Hi

I’m using rake+setup.rb to create a gem. It has a data-dir which is  
supposed to go into the shared data directory. My issue now is: how do I  
know in the executable where that data-dir went?  
Similar thing for the conf directory.

Regards  
Stefan

---

<div class="post-metadata">

**Author:** ![apeiros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/838e76/32.png) [@apeiros](https://www.ruby-forum.com/u/apeiros)\
**Post date:** [September 1, 2007, 4:22pm UTC](https://www.ruby-forum.com/t/setup-rb-and-shared-data/113546/2 "2007-09-01T16:22:45Z")

</div>

Stefan R. wrote:

> Hi
> 
> I’m using rake+setup.rb to create a gem. It has a data-dir which is  
> supposed to go into the shared data directory. My issue now is: how do I  
> know in the executable where that data-dir went?  
> Similar thing for the conf directory.
> 
> Regards  
> Stefan

Thanks to cout in [irc.freenode.org/#ruby-lang](http://irc.freenode.org/#ruby-lang) I solved my problem. In  
case somebody googles this thread due to the same problem, here’s the  
solution:  
require ‘rbconfig’  
data\_dir = Config::CONFIG[‘datadir’]

Regards  
Stefan

---

<div class="post-metadata">

**Author:** ![apeiros](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/838e76/32.png) [@apeiros](https://www.ruby-forum.com/u/apeiros)\
**Post date:** [September 2, 2007, 4:54am UTC](https://www.ruby-forum.com/t/setup-rb-and-shared-data/113546/3 "2007-09-02T04:54:16Z")

</div>

Hi,

At Sat, 1 Sep 2007 23:22:48 +0900,  
Stefan R. wrote in [ruby-talk:267082]:

> > I’m using rake+setup.rb to create a gem. It has a data-dir which is  
> > supposed to go into the shared data directory. My issue now is: how do I  
> > know in the executable where that data-dir went?  
> > Similar thing for the conf directory.
> 
> Thanks to cout in [irc.freenode.org/#ruby-lang](http://irc.freenode.org/#ruby-lang) I solved my problem. In  
> case somebody googles this thread due to the same problem, here’s the  
> solution:  
> require ‘rbconfig’  
> data\_dir = Config::CONFIG[‘datadir’]

If you want put architecture dependent files, they shouldn’t go  
the shared data directory, use ‘libexecdir’ instead.
