Skip to content

Instantly share code, notes, and snippets.

@vertiginous
Created January 29, 2011 15:16
Show Gist options
  • Save vertiginous/801907 to your computer and use it in GitHub Desktop.
Save vertiginous/801907 to your computer and use it in GitHub Desktop.
File#realpath behavior on Windows
C:\>ruby --disable-gems -S irb
irb(main):001:0> File.realpath('repo')
### FindFirstFileW ( "C:\repo", 0x0028e800 )
### FindClose ( 0x00754d10 )
=> "C:/repo"
irb(main):002:0> File.expand_path('repo')
### FindFirstFileA ( "C:/repo", 0x0028eac0 )
### FindClose ( 0x00754d10 )
=> "C:/repo"
irb(main):003:0> File.realpath('documents and settings')
### FindFirstFileW ( "C:\documents and settings", 0x0028e7e0 )
### FindClose ( 0x00754d10 )
=> "C:/documents and settings"
irb(main):004:0> File.expand_path('documents and settings')
### FindFirstFileA ( "C:/documents and settings", 0x0028eac0 )
### FindClose ( 0x007554d0 )
=> "C:/Documents and Settings"
irb(main):005:0> File.realpath("C:/Users/gthiesfeld/.pik/rubies/ruby-1.9.3-dev/lib/ruby/1.9.1/digest/hmac.rb")
### FindFirstFileW ( "C:\Users", 0x0028e800 )
### FindClose ( 0x007554d0 )
### FindFirstFileW ( "C:\Users\gthiesfeld", 0x0028e7f0 )
### FindClose ( 0x007554d0 )
### FindFirstFileW ( "C:\Users\gthiesfeld\.pik", 0x0028e7e0 )
### FindClose ( 0x007554d0 )
### FindFirstFileW ( "C:\Users\gthiesfeld\.pik\rubies", 0x0028e7d0 )
### FindClose ( 0x007554d0 )
### FindFirstFileW ( "C:\Users\gthiesfeld\.pik\rubies\ruby-1.9.3-dev", 0x0028e7c0 )
### FindClose ( 0x007554d0 )
### FindFirstFileW ( "C:\Users\gthiesfeld\.pik\rubies\ruby-1.9.3-dev\lib", 0x0028e7b0 )
### FindClose ( 0x007554d0 )
### FindFirstFileW ( "C:\Users\gthiesfeld\.pik\rubies\ruby-1.9.3-dev\lib\ruby", 0x0028e7a0 )
### FindClose ( 0x007554d0 )
### FindFirstFileW ( "C:\Users\gthiesfeld\.pik\rubies\ruby-1.9.3-dev\lib\ruby\1.9.1", 0x0028e7a0 )
### FindClose ( 0x007554d0 )
### FindFirstFileW ( "C:\Users\gthiesfeld\.pik\rubies\ruby-1.9.3-dev\lib\ruby\1.9.1\digest", 0x0028e790 )
### FindClose ( 0x007554d0 )
### FindFirstFileW ( "C:\Users\gthiesfeld\.pik\rubies\ruby-1.9.3-dev\lib\ruby\1.9.1\digest\hmac.rb", 0x0028e780 )
### FindClose ( 0x007554d0 )
=> "C:/Users/gthiesfeld/.pik/rubies/ruby-1.9.3-dev/lib/ruby/1.9.1/digest/hmac.rb"
irb(main):006:0> File.expand_path("C:/Users/gthiesfeld/.pik/rubies/ruby-1.9.3-dev/lib/ruby/1.9.1/digest/hmac.rb")
### FindFirstFileA ( "C:/Users/gthiesfeld/.pik/rubies/ruby-1.9.3-dev/lib/ruby/1.9.1/digest/hmac.rb", 0x0028eac0 )
### FindClose ( 0x007554d0 )
=> "C:/Users/gthiesfeld/.pik/rubies/ruby-1.9.3-dev/lib/ruby/1.9.1/digest/hmac.rb"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment