octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: glob on Windows systems (was: Re: Compile problem with gnulib)


From: Tatsuro MATSUOKA
Subject: Re: glob on Windows systems (was: Re: Compile problem with gnulib)
Date: Thu, 14 Jan 2010 06:31:10 +0900 (JST)

Hello

In my building, I am now stopping at documentation error.  I have seen that 
octave.exe built. Then I
temporary tried to execute ./run-octave however octave did not run with 
application error.

So I cannot test modified glob.

Regards

Tasuto 



--- "John W. Eaton" wrote:

> On 11-Jan-2010, John W. Eaton wrote:
> 
> |   glob: does not work properly with backslash directory separator
> 
> Instead of modifying the gnulib glob function to handle \\ in
> filenames, I propose the following patch for Octave.  Could someone
> who is building on MinGW or with MSVC try this patch and let me know
> whether it works?  If it does and there are no objections to this
> solution, I'll apply the changeset.
> 
> Thanks,
> 
> jwe
> 
> > # HG changeset patch
> # User John W. Eaton <address@hidden>
> # Date 1263377473 18000
> # Node ID 94abf7bd2fb0ac174c24659edca2adc4b3efb46e
> # Parent  d90736774da2e51e176b62c870e2f57b94b2d6b1
> transform dirsep for glob on Windows systems
> 
> diff --git a/liboctave/ChangeLog b/liboctave/ChangeLog
> --- a/liboctave/ChangeLog
> +++ b/liboctave/ChangeLog
> @@ -1,3 +1,9 @@
> +2010-01-13  John W. Eaton  <address@hidden>
> +
> +     * glob-match.cc (glob_match::glob_internal): If using a Windows
> +     system without a POSIX filesystem, transform \ to / before
> +     calling glob, and transform / to \ in the returned strings.
> +
>  2010-01-11  Rik <address@hidden>
>  
>       * Makefile.am: Remove unnecessary use of simple_move_if_change_rule to 
> allow
> diff --git a/liboctave/glob-match.cc b/liboctave/glob-match.cc
> --- a/liboctave/glob-match.cc
> +++ b/liboctave/glob-match.cc
> @@ -27,6 +27,7 @@
>  #include <fnmatch.h>
>  #include <glob.h>
>  
> +#include <algorithm>
>  #include <iostream>
>  #include <string>
>  
> @@ -97,6 +98,13 @@
>       {
>         glob_t glob_info;
>  
> +#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \
> +  && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)
> +          std::replace_if (xpat.begin (), xpat.end (),
> +                           std::bind2nd (std::equal_to<char> (), '\\'),
> +                           '/')p;
> +#endif
> +
>         int err = ::glob (xpat.c_str (), GLOB_NOSORT, 0, &glob_info);
>  
>         if (! err)
> @@ -117,7 +125,19 @@
>                 retval.resize (k+n);
>  
>                 for (int j = 0; j < n; j++)
> -                 retval[k++] = matches[j];
> +                    {
> +                      std::string tmp = matches[j];
> +
> +#if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \
> +  && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)
> +                      std::replace_if (tmp.begin (), tmp.end (),
> +                                       std::bind2nd (std::equal_to<char> (),
> +                                                     '/'),
> +                                       '\\');
> +#endif
> +
> +                      retval[k++] = tmp;
> +                    }
>               }
>  
>             globfree (&glob_info);
> 


--------------------------------------
Get the new Internet Explorer 8 optimized for Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/ie8/


reply via email to

[Prev in Thread] Current Thread [Next in Thread]