Feature #3356

Add GetShortPathName to ruby

Added by docwhat (Christian Höltje) almost 2 years ago. Updated about 1 month ago.

[ruby-core:30470]
Status:Feedback Start date:05/28/2010
Priority:Low Due date:
Assignee:- % Done:

0%

Category:lib
Target version:-

Description

Hi!

I use Ruby on windows and it would be really useful to have access to GetShortPathName in ruby.

I have a monkey-patch to add Pathname.shortpath (attached) to demonstrate it.  Probably realpath, etc. should take this in to account as well, since in windows, only the shortpath is canonical.

In addition, the shortpath doesn't need to be escaped, so you can use it with backticks (`), etc.

Ciao!

pathname-shortpath.rb - Monkey patch to pathname (640 Bytes) docwhat (Christian Höltje), 05/28/2010 01:42 am

History

Updated by akr (Akira Tanaka) almost 2 years ago

2010/5/28 Christian Höltje <redmine@ruby-lang.org>:

> Bug #3356: Add GetShortPathName to ruby
> http://redmine.ruby-lang.org/issues/show/3356
>
> I use Ruby on windows and it would be really useful to have access to GetShortPathName in ruby.

I think it should be defined as a class method of File at first,
as other many methods in Pathname.
-- 
Tanaka Akira

Updated by rogerdpack (Roger Pack) 9 months ago

I could use this as well (because some File-like classes return an 8.3 filename, some the full filename, so not always is the 8.3 name available), though ffi is or winapi is a good work-around for the present.

Updated by mame (Yusuke Endoh) about 1 month ago

  • Description updated (diff)
  • Status changed from Open to Assigned
  • Assignee set to nobu (Nobuyoshi Nakada)

Updated by nobu (Nobuyoshi Nakada) about 1 month ago

  • Status changed from Assigned to Feedback
  • Assignee deleted (nobu (Nobuyoshi Nakada))
  • Priority changed from Normal to Low
What do you mean by "canonical"? It doesn't feel like "canonical" at all.

Also available in: Atom PDF