https://redmine.ruby-lang.org/https://redmine.ruby-lang.org/favicon.ico?17113305112010-05-31T21:55:28ZRuby Issue Tracking SystemRuby master - Feature #3356: Add GetShortPathName to rubyhttps://redmine.ruby-lang.org/issues/3356?journal_id=113912010-05-31T21:55:28Zakr (Akira Tanaka)akr@fsij.org
<ul></ul><p>=begin<br>
2010/5/28 Christian Höltje <a href="mailto:redmine@ruby-lang.org" class="email">redmine@ruby-lang.org</a>:</p>
<blockquote>
<p>Bug <a class="issue tracker-2 status-7 priority-4 priority-default closed" title="Feature: Add GetShortPathName to ruby (Feedback)" href="https://redmine.ruby-lang.org/issues/3356">#3356</a>: Add GetShortPathName to ruby<br>
<a href="http://redmine.ruby-lang.org/issues/show/3356" class="external">http://redmine.ruby-lang.org/issues/show/3356</a></p>
<p>I use Ruby on windows and it would be really useful to have access to GetShortPathName in ruby.</p>
</blockquote>
<h2>I think it should be defined as a class method of File at first,<br>
as other many methods in Pathname.</h2>
<p>Tanaka Akira</p>
<p>=end</p> Ruby master - Feature #3356: Add GetShortPathName to rubyhttps://redmine.ruby-lang.org/issues/3356?journal_id=204242011-08-27T01:16:12Zrogerdpack (Roger Pack)rogerpack2005@gmail.com
<ul></ul><p>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.</p> Ruby master - Feature #3356: Add GetShortPathName to rubyhttps://redmine.ruby-lang.org/issues/3356?journal_id=250942012-03-25T14:06:14Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Description</strong> updated (<a title="View differences" href="/journals/25094/diff?detail_id=18375">diff</a>)</li><li><strong>Status</strong> changed from <i>Open</i> to <i>Assigned</i></li><li><strong>Assignee</strong> set to <i>nobu (Nobuyoshi Nakada)</i></li></ul> Ruby master - Feature #3356: Add GetShortPathName to rubyhttps://redmine.ruby-lang.org/issues/3356?journal_id=250952012-03-25T14:08:56Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Assigned</i> to <i>Feedback</i></li><li><strong>Assignee</strong> deleted (<del><i>nobu (Nobuyoshi Nakada)</i></del>)</li><li><strong>Priority</strong> changed from <i>Normal</i> to <i>3</i></li></ul><p>What do you mean by "canonical"?<br>
It doesn't feel like "canonical" at all.</p> Ruby master - Feature #3356: Add GetShortPathName to rubyhttps://redmine.ruby-lang.org/issues/3356?journal_id=332362012-11-20T21:35:02Zmame (Yusuke Endoh)mame@ruby-lang.org
<ul><li><strong>Target version</strong> set to <i>2.6</i></li></ul> Ruby master - Feature #3356: Add GetShortPathName to rubyhttps://redmine.ruby-lang.org/issues/3356?journal_id=333482012-11-21T00:17:13Zluislavena (Luis Lavena)luislavena@gmail.com
<ul><li><strong>Assignee</strong> set to <i>usa (Usaku NAKAMURA)</i></li></ul><p>Hello,</p>
<p>AFAIK shortnames might not be available on some NTFS volumes, under some circumstances I found is off for performance.</p>
<p>Shortname version of a filename is not canonical, is just one of many representations of a file in the filesystem.</p>
<p>If the intention is use short_name to be able to shell out, why not improve Windows support on ShellWords so it properly escapes the path instead?</p>
<p>We keep improving Ruby on Windows to properly support long names and path with spaces that adding this seems counter productive from my point of view.</p>
<p>I'm assigning to Nakamura-san for decision.</p>
<p>Thank you.</p> Ruby master - Feature #3356: Add GetShortPathName to rubyhttps://redmine.ruby-lang.org/issues/3356?journal_id=333812012-11-21T16:59:16Zusa (Usaku NAKAMURA)usa@garbagecollect.jp
<ul></ul><p>Hello,</p>
<p>In message "<a href="/issues/3356">[ruby-core:49766]</a> [ruby-trunk - Feature <a class="issue tracker-2 status-7 priority-4 priority-default closed" title="Feature: Add GetShortPathName to ruby (Feedback)" href="https://redmine.ruby-lang.org/issues/3356">#3356</a>] Add GetShortPathName to ruby"<br>
on Nov.21,2012 00:17:14, <a href="mailto:luislavena@gmail.com" class="email">luislavena@gmail.com</a> wrote:</p>
<blockquote>
<p>Shortname version of a filename is not canonical, is just one of many representations of a file in the filesystem.</p>
</blockquote>
<p>agreed.<br>
I've realized that the shortname is a kind of a hardlink.</p>
<blockquote>
<p>If the intention is use short_name to be able to shell out, why not improve Windows support on ShellWords so it properly escapes the path instead?</p>
<p>We keep improving Ruby on Windows to properly support long names and path with spaces that adding this seems counter productive from my point of view.</p>
</blockquote>
<p>agreed.</p>
<p>However, improving the longname (expecially including spaces) is not<br>
conflict to add a new method to get shortname, I think.<br>
Since I do not have a usecase of the method, I cannot judge whether<br>
the method is necessery or not.<br>
Therefore, users who need the method should show some suitable usecases.<br>
Of course, as menthioned above, to gloss over the problems in ruby itself<br>
with handling longnames.</p>
<a name="Regards"></a>
<h2 >Regards,<a href="#Regards" class="wiki-anchor">¶</a></h2>
<p>U.Nakamura <a href="mailto:usa@garbagecollect.jp" class="email">usa@garbagecollect.jp</a></p> Ruby master - Feature #3356: Add GetShortPathName to rubyhttps://redmine.ruby-lang.org/issues/3356?journal_id=562422016-01-21T10:17:33Zsschuberth (Sebastian Schuberth)
<ul></ul><p>Usaku NAKAMURA wrote:</p>
<blockquote>
<p>Since I do not have a usecase of the method, I cannot judge whether<br>
the method is necessery or not.<br>
Therefore, users who need the method should show some suitable usecases.</p>
</blockquote>
<p>I'd also like to see a "shortpath" method implemented, but also the opposite "longpath" (like suggested at [1]).</p>
<p>My use-case is that I need de-duplicate a list of Windows paths, i.e. generate a list of unique paths. The list may contain short paths as well as long paths, so a solution would be to first convert all paths to their long form, and then do case-insensitive string matches. Currently, that does not seem possible in Ruby as there's not way to explicitly get a long path for a short path (also see [2]) or vice versa. If we have a "longpath" (or "shortpath) we should also have a "shortpath" (or "longpath") for symmetry.</p>
<p>[1] <a href="http://stackoverflow.com/a/8142448/1127485" class="external">http://stackoverflow.com/a/8142448/1127485</a><br>
[2] <a href="http://stackoverflow.com/q/34919422/1127485" class="external">http://stackoverflow.com/q/34919422/1127485</a></p> Ruby master - Feature #3356: Add GetShortPathName to rubyhttps://redmine.ruby-lang.org/issues/3356?journal_id=562492016-01-21T14:27:25Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p>You can get the stored name by <code>File.realpath</code>, and tell if two files are same by <code>File.identical?</code>.</p>