Module: Vagrant::Util::WindowsPath
- Defined in:
- lib/vagrant/util/windows_path.rb
Defined Under Namespace
Modules: API
Class Method Summary collapse
-
.longname(name) ⇒ Object
Converts a Windows shortname to a long name.
Class Method Details
.longname(name) ⇒ Object
Converts a Windows shortname to a long name. This only works for ASCII paths currently and doesn't use the wide character support.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/vagrant/util/windows_path.rb', line 18 def self.longname(name) # We loop over the API call in case we didn't allocate enough # buffer space. In general it is usually enough. bufferlen = 250 buffer = nil while true buffer = ' ' * bufferlen len = API.GetLongPathNameA(name.to_s, buffer, buffer.size) if bufferlen < len # If the length returned is larger than our buffer length, # it is the API telling us it needs more space. Allocate it # and retry. bufferlen = len continue end break end return buffer.rstrip.chomp("\0") end |