[Rake-devel] File tasks bug - comparing paths

John Ludlow john.ludlow.uk at gmail.com
Mon Jul 3 06:23:10 EDT 2006


Hi,

In Rake a file task may be something like

file app_obj => app_cpp
   # compile
end

 We've discovered that in some cases (such as where a path comes from the
OS, an environment variable, say), it will contain backslashes, and
sometimes (where Ruby has generated the path, or where we've coded it into
the script - / is easier to read than \\) it will contain forward
slashes.  This difference seems to be significant when the paths are
compared.

This results in the situation where the equivalent paths c:\folder\app.cpp
and c:/folder/app.cpp are treated as being completely different.  (We also
get a mix of slashes in a single path:  c:\folder/app.cpp).

It would make sense, IMHO, for these paths to be treated as the same.

Is there any way to do this?  The closest thing I could find was this:

# Find a matching task for +task_name+.
def [](task_name, scopes=nil)
      task_name = task_name.to_s
      self.lookup(task_name, scopes) or
           enhance_with_matching_rule(task_name) or
           synthesize_file_task(task_name) or
           fail "Don't know how to build task '#{task_name}'"
end

I suppose I'd have to override this to loop through all the prerequisites
and compare them, making the slashes on both sides consistent?

Thanks

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rake-devel/attachments/20060703/5c34d336/attachment.html 


More information about the Rake-devel mailing list