Sha256: 9b7ac7070eed64c86c63a9dfaa6f2bcdfbc24d68a8e302bdce4766f4fd82fe2e
Contents?: true
Size: 1.16 KB
Versions: 9
Compression:
Stored size: 1.16 KB
Contents
module XamarinTestCloud class TmpDir require "xamarin-test-cloud/environment" require "tmpdir" def self.mktmpdir tmpdir = Dir.mktmpdir if XamarinTestCloud::Environment.windows_env? tmpdir = self.windows_long_path(tmpdir) end tmpdir end private # Given a Windows user with name moodymoodymoody (> 9 characters) # Dir.mktmpdir returns: # # C:\Users\MOODYM~1\AppData\Local\Temp # # This breaks path equality assertions. File.expand_path does not expand # this MOODYM~1. # # Thanks @ http://stackoverflow.com/questions/8128863/how-to-get-long-filename-from-argv # TODO: We don't know the behavior on 64 bit rubies. def self.windows_long_path(short_name) require "Win32API" max_path = 1024 long_name = " " * max_path lfn_size = Win32API.new("kernel32", "GetLongPathName", ['P','P','L'],'L').call(short_name, long_name, max_path) (1..max_path).include?(lfn_size) ? long_name[0..lfn_size-1] : short_name end end end
Version data entries
9 entries across 9 versions & 1 rubygems