[macruby-changes] [3127] MacRuby/trunk/bin/rubyc

source_changes at macosforge.org source_changes at macosforge.org
Thu Dec 17 13:36:56 PST 2009


Revision: 3127
          http://trac.macosforge.org/projects/ruby/changeset/3127
Author:   lsansonetti at apple.com
Date:     2009-12-17 13:36:52 -0800 (Thu, 17 Dec 2009)
Log Message:
-----------
when generating the feature name out of an object file, strip the trailing ./ if needed and warn if the path is absolute

Modified Paths:
--------------
    MacRuby/trunk/bin/rubyc

Modified: MacRuby/trunk/bin/rubyc
===================================================================
--- MacRuby/trunk/bin/rubyc	2009-12-17 02:37:03 UTC (rev 3126)
+++ MacRuby/trunk/bin/rubyc	2009-12-17 21:36:52 UTC (rev 3127)
@@ -78,15 +78,16 @@
       if @files.size > 1 and @output
         die "Cannot specify -o with -c or -C and multiple input files"
       end
-      file = @files[0]
-      if File.extname(file) != '.rb'
-        die "Given input file `#{file}' must be a Ruby source file (.rb)"
+      @files.each do |file|
+        if File.extname(file) != '.rb'
+          die "Given input file `#{file}' must be a Ruby source file (.rb)"
+        end
+        if @bundle
+          compile_bundle(file, @output)
+        else
+          compile_object(file, @output)
+        end
       end
-      if @bundle
-        compile_bundle(file, @output)
-      else
-        compile_object(file, @output)
-      end
     else
       die "Cannot specify --static and --dylib at the same time" if @dylib and @static
       objs = @files.map do |file|
@@ -326,7 +327,17 @@
   end
 
   def feature_name(obj)
-    obj.sub(/#{File.extname(obj)}$/, '')
+    # Remove trailing ./ if exists.
+    if obj[0..1] == './'
+      obj[0..1] = ''
+    end
+
+    if obj[0] == '/'
+      $stderr.puts "warning: object file path `#{obj}' is absolute and not relative, this might cause a problem later at runtime"
+    end
+
+    # Strip the extension.
+    obj = obj.sub(/#{File.extname(obj)}$/, '')
   end
 
   def gen_tmpfile(base, ext)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20091217/2b63be67/attachment.html>


More information about the macruby-changes mailing list