--fwqqG+mf3f7vyBCB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Wed, Feb 04, 2004 at 06:20:04AM +0900, Marek Janukowicz wrote:
> Where should I install data files for the library I wrote? They are
> connected with .rb files, so they should stay in the same directory, but
> setup.rb does not install anything but .rb files from lib/ subdirectory.
> The default data dir (/usr/share on my Gentoo Linux) does not seems
> appropiate, too (I want my library to be installed in one place). 
> 
> Maybe there should be something like java .jar files, which can contain
> not only java class files, but also the resource files (corrent me if
> I'm wrong)?

The nice thing about putting it in something like /usr/share is rbconfig
sets the location for you:

    require 'rbconfig'
    puts Config::CONFIG['datadir'] # => /usr/share on my machine

That being said, I have one project that uses a .glade file. I decided
to put it next to the .rb files, as you said. I had to modify setup.rb
slightly to allow this though. I changed the following:

  def ruby_scripts
    collect_filenames_auto().select {|n| /\.rb\z/ === n }
  end

to just

  def ruby_scripts
    collect_filenames_auto()
  end

You could keep the select and just add your datafile extensions there
too, of course. Just as a bonus, this is the code I use to find the data
file in the ruby path:

  def find_in_path(filename)
      $LOAD_PATH.find do |dir|
	try_file = File.join(dir, filename)
	return try_file if File.readable?(try_file)
      end
  end

--
Zachary P. Landau <kapheine / hypa.net>
GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc

--fwqqG+mf3f7vyBCB
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAIBa2CwWyMCTlrZkRAgu4AJ9TSAbds8/QYnMsKY9gd6SMmt88qgCeLmWD
ubemwhdEPPn3WwTvRvsL9CUßÛ7
-----END PGP SIGNATURE-----

--fwqqG+mf3f7vyBCB--