- @default_dirs ||= Hash[default_locations.collect do |destination, path|
- [destination, {
- :bin_dir => File.join(path, ConfigMap[:bindir].split(File::SEPARATOR).last),
- :gem_dir => File.join(path, ConfigMap[:datadir].split(File::SEPARATOR).last, 'gems'),
- :ext_dir => File.join(path, @libdir.split(File::SEPARATOR).last, 'gems')
- }]
- end]
+ @default_dirs ||= default_locations.inject(Hash.new) do |hash, location|
+ destination, path = location
+
+ hash[destination] = if path
+ {
+ :bin_dir => File.join(path, RbConfig::CONFIG['bindir'].split(File::SEPARATOR).last),
+ :gem_dir => File.join(path, RbConfig::CONFIG['datadir'].split(File::SEPARATOR).last, 'gems'),
+ :ext_dir => File.join(path, @libdir.split(File::SEPARATOR).last, 'gems')
+ }
+ else
+ {
+ :bin_dir => '',
+ :gem_dir => '',
+ :ext_dir => ''
+ }
+ end
+
+ hash
+ end