This project is archived and is in readonly mode.
Relative path on windows
Reported by xelex | March 19th, 2010 @ 08:39 PM
Incorrect generator behaviour on Windows (it fails):
C:/ruby/lib/ruby/1.8/pathname.rb:709:in
relative_path_from': different prefix:<br/> "C:/" and
"D:/work/ruby/test" (ArgumentError)
from C:/ruby/lib/ruby/gems/1.8/gems/radiant-0.8.1/vendor/rails/railties/lib/rails_generator/lookup.rb:110:in `use_component_sources!'
from C:/ruby/lib/ruby/gems/1.8/gems/radiant-0.8.1/vendor/rails/railties/lib/rails_generator/lookup.rb:109:in `each'
...
System configuration:
Rails 2.3.5 + Ruby 1.8.6 + Win XP 32bit
Steps to reproduce:
1. Place ruby on a C: drive, place rails on a D: drive.
2. Use some generator tools.
3. Get the exception.
The root cause is in the lib/rails_generator/lookup.rb (line
110):
relative_path =
Pathname.new(File.expand_path(path)).relative_path_from(Pathname.new(::RAILS_ROOT))
The relative_path_from raises an ArgumentError in the described
case.
Workaround is to patch the lib/rails_generator/lookup.rb and catch
the exception.
Dirty patch is to modify the 110 line in
lib/rails_generator/lookup.rb:
begin
relative_path =
Pathname.new(File.expand_path(path)).relative_path_from(Pathname.new(::RAILS_ROOT))
rescue ArgumentError
relative_path = Pathname.new(File.expand_path(path)) end
Comments and changes to this ticket
-
Santiago Pastorino February 2nd, 2011 @ 04:44 PM
- State changed from new to open
This issue has been automatically marked as stale because it has not been commented on for at least three months.
The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.
Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.
-
Santiago Pastorino February 2nd, 2011 @ 04:44 PM
- State changed from open to stale
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>