Re: directory separator

2025-04-22 Thread Mitch Capper
Makes sense. I used the function in these gnulib modules that currently do not have a dependency on basename (i believe): exclude, fts, glob, link, progname.I noticed for some, like link, they reimplement the basename functionality (although slightly lacking): https://github.com/coreutils/gnul

Re: directory separator

2025-04-21 Thread Bruno Haible via Gnulib discussion list
Mitch Capper wrote: > Right now filename has no > dependencies but doing this adds basename. I understand circular > dependencies can be handled, but am I fine to just add a new dependency on > a core module like this? No, it's better if 'filename' stays as a module without dependencies. Therefor

Re: directory separator

2025-04-21 Thread Mitch Capper
Not thinking of the bigger picture, rather than looking to replicate the string functionality originally there I should have considered the end goal before evaluating possible gnulib modules. Will update. This does bring me back to part of the original question. Right now filename has no depend

Re: directory separator

2025-04-21 Thread Bruno Haible via Gnulib discussion list
Mitch Capper wrote: > there is no gnulib module for strrpbrk or strrcspn. Indeed, such functions are non-standard and not in gnulib. > This was used for > the LAST_SLASH_IN_PATH macro I added. I temporarily just added a static > implementation to the header along the lines of: > ``` > static con

Re: directory separator

2025-04-16 Thread Mitch Capper
That was my mistake, missed an r in there which also means there is no gnulib module for strrpbrk or strrcspn. This was used for the LAST_SLASH_IN_PATH macro I added. I temporarily just added a static implementation to the header along the lines of: ``` static const char* strrpbrk(const char* s,

Re: directory separator

2025-02-16 Thread Bruno Haible via Gnulib discussion list
Mitch Capper wrote: > I did implement most of the shared path code in lib/filename.h but for > windows I do need strpbrk. Am I ok to just add that as a dependency for > the filename module? You don't even need this dependency, since native Windows has strpbrk and since the doc (doc/posix-functio

Re: directory separator

2025-02-16 Thread Mitch Capper
> If I have understood it correctly, the best way to handle file names on native > Windows is to > - use '\\' as a directory separator when composing file names, > - allow both '/' and '\\' when inspecting file names. Yes, that is largely what I

Re: directory separator

2025-02-15 Thread Bruno Haible via Gnulib discussion list
e certainly like to see fixes in this area. If I have understood it correctly, the best way to handle file names on native Windows is to - use '\\' as a directory separator when composing file names, - allow both '/' and '\\' when inspecting file names. Bruno

Re: [PATCH] directory separator

2012-06-07 Thread John Darrington
t it would be trivial to add support for some future operating system that decides to use a different character (neither / nor \) as the directory separator. A third reason: "a/b" looks to me like a mathematical expression, whereas "a" DIRECTORY_SEPARATOR_STRING "b&quo

Re: [PATCH] directory separator

2012-06-07 Thread Paul Eggert
On 06/07/2012 12:19 AM, John Darrington wrote: > Surely using a symbol instead of a literal constant makes maintenance easier > not > harder? I don't see why. For example: remove ("a/b"); is simpler and easier to maintain than: #if DIRECTORY_SEPARATOR == '/' #define DIRECTORY_SEPARAT

Re: [PATCH] directory separator

2012-06-07 Thread John Darrington
On Wed, Jun 06, 2012 at 01:07:41PM -0700, Paul Eggert wrote: On 06/06/2012 12:43 PM, John Darrington wrote: > If as you say, windows prefers \ is there a good reason NOT to use it? Mostly to avoid the maintenance hassle. Surely using a symbol instead of a literal constant mak

Re: [PATCH] directory separator

2012-06-06 Thread Paul Eggert
On 06/06/2012 12:43 PM, John Darrington wrote: > If as you say, windows prefers \ is there a good reason NOT to use it? Mostly to avoid the maintenance hassle. Also, the change makes the code a bit bigger and slower even on non-Windows platforms.

Re: [PATCH] directory separator

2012-06-06 Thread John Darrington
On Wed, Jun 06, 2012 at 01:10:09PM -0600, Eric Blake wrote: On 06/06/2012 12:54 PM, John Darrington wrote: > I'm offering this patch which ensures that the paths of tempfiles are > created with the appropriate separator for the machine. What platform did you need it on?

Re: [PATCH] directory separator

2012-06-06 Thread Eric Blake
On 06/06/2012 12:54 PM, John Darrington wrote: > I'm offering this patch which ensures that the paths of tempfiles are > created with the appropriate separator for the machine. What platform did you need it on? Windows understands paths with /, even if it prefers \ as the canonical separator, an

[PATCH] directory separator

2012-06-06 Thread John Darrington
I'm offering this patch which ensures that the paths of tempfiles are created with the appropriate separator for the machine. J' -- PGP Public key ID: 1024D/2DE827B3 fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3 See http://keys.gnupg.net or any PGP keyserver for public key.