Ruby method for convering Windows short path into long path? -


is there built-in method in ruby convert windows short path like

c:\progra~2\micros~1.0\vc\bin\amd64 

into corresponding long path

c:\program files (x86)\microsoft visual studio 12.0\vc\bin\amd64 

i've tried

  • file.expand_path(short_path)
  • pathname.new(short_path).cleanpath
  • pathname.new(short_path).realpath
  • dir.chdir(short_path) { dir.pwd }

but none of these worked.

if possible, i'd avoid calling win32 api directly in this answer, or ugly work-arounds spawning powershell:

%x{powershell (get-item -literalpath #{short_path}).fullname} 

here 1 possible workaround:

path=dir.mktmpdir('vendor') => "c:/users/admini~1/appdata/local/temp/1/vendor20160727-12668-ywfjol"  dir.glob(path)[0] => "c:/users/administrator/appdata/local/temp/1/vendor20160727-12668-ywfjol" 

Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -