[patch] mkdir at post-time (take 2)

why the lucky stiff why at hobix.com
Mon Jun 20 01:20:09 EDT 2005


MenTaLguY wrote:

>+	    # starting from @basepath and excluding the entry itself
>+            id.split( '/' )[0...-1].inject( [@basepath] ) do |ancestors, c|
>+                ancestors.push File.join( ancestors.last, c )
>+                ancestors
>+            # create all the ancestor directories under @basepath as needed
>+            end[1..-1].each do |ancestor|
>+                begin
>+                    Dir.mkdir ancestor
>+                rescue Errno::EEXIST
>+                end
>+            end
>+            retry
>+        end
>  
>
Hey, can we just use mkdir_p or makedirs instead of all this?  And you 
have your privileges now.

_why


More information about the Hobix-is-the-way mailing list