Project

General

Profile

Actions

Bug #2625

closed

rdoc patch for Dir.glob

Added by rogerdpack (Roger Pack) over 14 years ago. Updated about 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
trunk
Backport:
[ruby-core:27669]

Description

=begin
This makes it more explicit for us poor windows users that Dir.glob cannot use \

Note that perl actually states this"

On MS-DOSish systems, the backslash is a valid directory separator character.[4] In this case, use of backslash as a quoting character (via GLOB_QUOTE) interferes with the use of backslash as a directory separator. The best (simplest, most portable) solution is to use slashes for directory separators, backslashes for quoting. However, this does not match some users' expectations, so backslashes (under GLOB_QUOTE) quote only the glob metacharacters [, ], {, }, -, ~, and \ itself. All other backslashes are passed through unchanged, if you can manage to get them by Perl's own backslash quoting in strings. It may take as many as four backslashes to finally match one in the filesystem. This is so completely insane that even MS-DOSish users should strongly consider using slashes. If you really want to use backslashes, look into the standard File::DosGlob module, as it might be more to your liking than Unix-flavored fileglobbing.

"

perhaps something like that would be considered, as well?

Index: dir.c

--- dir.c (revision 26325)
+++ dir.c (working copy)
@@ -1732,6 +1732,9 @@

  •                      Equivalent to pattern alternation in
    
  •                      regexp.
    
  • </code>:: Escapes the next metacharacter.
    •                      Note that this means you cannot use backslash in windows
      
    •                      as part of a glob, i.e. Dir["c:\\*"] will not work
      
    •                      use Dir["c:/*"] instead
      
    • Dir["config.?"]                     #=> ["config.h"]
      
    • Dir.glob("config.?")                #=> ["config.h"]
      

=end

Actions #1

Updated by naruse (Yui NARUSE) over 14 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
This issue was solved with changeset r26385.
Roger, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

=end

Actions

Also available in: Atom PDF

Like0
Like0