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

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -