[#45703] test_advise failure on GNU/Linux — Tanaka Akira <tanaka.akira@...>

今朝、気がついたのですが、手元で test_advise が失敗します。

11 messages 2012/06/05
[#45705] Re: test_advise failure on GNU/Linux — KOSAKI Motohiro <kosaki.motohiro@...> 2012/06/06

小崎です

[#45735] [ruby-trunk - Feature #6587][Open] proposal: adding new methods File.rootname and Pathname#rootname — "usa (Usaku NAKAMURA)" <usa@...>

14 messages 2012/06/14

[#45745] Re: [ruby-changes:24028] yugui:r36079 (trunk): Embedding CRuby interpreter without internal headers has been difficult — SASADA Koichi <ko1@...>

見逃していました.

19 messages 2012/06/14
[#45747] Re: [ruby-changes:24028] yugui:r36079 (trunk): Embedding CRuby interpreter without internal headers has been difficult — Yugui <yugui@...> 2012/06/15

2012/6/15 SASADA Koichi <ko1@atdot.net>:

[#45748] Re: [ruby-changes:24028] yugui:r36079 (trunk): Embedding CRuby interpreter without internal headers has been difficult — SASADA Koichi <ko1@...> 2012/06/15

 ささだです.

[#45794] :new_pgroup and :pgroup option for spawn. — Tanaka Akira <akr@...>

process.c で気がついたのですが、spawn に Windows 用の :new_pgroup というオプションが

12 messages 2012/06/23
[#45800] Re: :new_pgroup and :pgroup option for spawn. — "U.Nakamura" <usa@...> 2012/06/25

こんにちは、なかむら(う)です。

[#45818] [ruby-trunk - Feature #6643][Open] io.seek(off, :end) — "akr (Akira Tanaka)" <akr@...>

30 messages 2012/06/25

[ruby-dev:45743] [ruby-trunk - Feature #6587] proposal: adding new methods File.rootname and Pathname#rootname

From: "nobu (Nobuyoshi Nakada)" <nobu@...>
Date: 2012-06-14 09:04:39 UTC
List: ruby-dev #45743
Issue #6587 has been updated by nobu (Nobuyoshi Nakada).

File 0001-File.rootname.patch added

とりあえずパッチ置いときます。
----------------------------------------
Feature #6587: proposal: adding new methods File.rootname and Pathname#rootname
https://bugs.ruby-lang.org/issues/6587#change-27248

Author: usa (Usaku NAKAMURA)
Status: Open
Priority: Normal
Assignee: 
Category: 
Target version: 2.0.0


=begin
みんな大好き Unixen ではパスの先頭は '/' で始まるものという暗黙の前提がありますが、Windows ではドライブレターおよび UNC というものがあるのでその前提が成り立たないことは広く知られていると思います。
Ruby はドライブレターや UNC はそれなりに適切に取り扱うようになっていますが、残念ながらパス名を処理する際には依然としてロジックを自前で用意する必要があります。
例えば ruby 配布物の test/ 以下を見ると、独自にドライブレター周りを扱おうとしているコードが散見されますが、それぞれ異なる処理を書いており、UNC や拡張パス名(という名前でいいかどうかわかりませんが、"//?/" あるいは "//./" で始まるもの)まで含めて適切に取り扱えているコードはほぼありません。

そこで、(({dirname}))、(({basename}))、(({extname})) などから類推して、(({rootname})) というメソッドを (({File})) の特異メソッドおよび (({Pathname})) のメソッドとして追加することを提案します。

--- File.rootname(filename) -> String
    filename のうち、ルートディレクトリあるいはそれに相当する部分を文字列として返します。
    filename が相対パスなどの場合は ""(空文字列)を返します。
     # on Unixen
     p File.rootname("/foo/bar.txt") #=> "/" (absolute path)
     p File.rootname("bar.txt")      #=> ""  (relative path)

     # on Windows
     p File.rootname("/foo/bar.txt")         #=> "" (relative path)
     p File.rootname("bar.txt")              #=> "" (relative path)
     p File.rootname("C:/foo/bar.txt")       #=> "C:/" (normal absolute path)
     p File.rootname("C:bar.txt")            #=> "" (relative path)
     p File.rootname("//host/share/baz.txt") #=> "//host/share" (UNC absolute path)
     p File.rootname("//?/C:/foo/bar.txt")   #=> "//?/C:/" (extended form absolute path)

--- Pathname#rootname
    Pathname.new(File.rootname(self.to_s)) と同じです。
=end



-- 
http://bugs.ruby-lang.org/

In This Thread