Re: [Musicpd-dev-team] UTF-8 file names support for Windows

2013-01-20 Thread Max Kellermann
On 2013/01/19 07:33, Denis Krjuchkov de...@crazydev.net wrote: Important thing for wrappers is error management: errno might be messed in between because constructing Path might change it. What are options here? Path::Null() does not modify errno. And Path::Null() shall be returned on error.

Re: [Musicpd-dev-team] FileSystem: new library for Path-friendly file system routines

2013-01-20 Thread Ben Boeckel
On Sun, Jan 20, 2013 at 19:10:28 +0600, Denis Krjuchkov wrote: Pushed slightly improved version: http://git.musicpd.org/cgit/dk/mpd.git/commit/?id=e6ed592b8aeb5025be0893ee99ff44e46a9ffd1c For CheckExists, you should use lstat instead of stat. stat will error if the path is a broken symlink.

Re: [Musicpd-dev-team] UTF-8 file names support for Windows

2013-01-20 Thread Ben Boeckel
On Sun, Jan 20, 2013 at 16:20:13 +0100, Max Kellermann wrote: C++ provides wrappers for standard C headers (e.g. cstdio for stdio.h). Are there any rules on them? I tend to use them, however they have serious disadvantage: it's hard to predict whenever some function would appear to std

Re: [Musicpd-dev-team] UTF-8 file names support for Windows

2013-01-20 Thread Max Kellermann
On 2013/01/19 13:09, Denis Krjuchkov de...@crazydev.net wrote: I've played a bit with the code. It seems convenient to change Path::ToUTF8() to return std::string. I'd like to not introduce something like PathUTF8 class and use standard types where applicable. Agree. * We could predict

Re: [Musicpd-dev-team] FileSystem: new library for Path-friendly file system routines

2013-01-20 Thread Max Kellermann
On 2013/01/20 14:10, Denis Krjuchkov de...@crazydev.net wrote: Pushed slightly improved version: http://git.musicpd.org/cgit/dk/mpd.git/commit/?id=e6ed592b8aeb5025be0893ee99ff44e46a9ffd1c Thanks, that looks like a good start, I have merged it. What I don't like: - FileSystem.hxx includes

Re: [Musicpd-dev-team] FileSystem: new library for Path-friendly file system routines

2013-01-20 Thread Ben Boeckel
On Sun, Jan 20, 2013 at 17:14:12 +0100, Max Kellermann wrote: - slightly disagree with Ben (but thanks for pointing out that potential problem): there should be some way to specify whether symbolic links shall be followed. Some callers may want to follow symlinks, some do not, and the

Re: [Musicpd-dev-team] FileSystem: new library for Path-friendly file system routines

2013-01-20 Thread Max Kellermann
On 2013/01/20 17:24, Ben Boeckel maths...@gmail.com wrote: On Sun, Jan 20, 2013 at 17:14:12 +0100, Max Kellermann wrote: - slightly disagree with Ben (but thanks for pointing out that potential problem): there should be some way to specify whether symbolic links shall be followed. Some

Re: [Musicpd-dev-team] FileSystem: new library for Path-friendly file system routines

2013-01-20 Thread Ben Boeckel
On Sun, Jan 20, 2013 at 17:25:26 +0100, Max Kellermann wrote: bool IsRegularFile(Path, bool follow_symlinks=true) That works as well. --Ben -- Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC,

Re: [Musicpd-dev-team] FileSystem: new library for Path-friendly file system routines

2013-01-20 Thread Denis Krjuchkov
20.01.2013 22:14, Max Kellermann пишет: - FileSystem.hxx includes all relevant system headers, and I would like to reduce header dependencies as much as possible; include special things like dirent.h only if you really want to read directory contents Agree, I think we could extract