[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with output file on windows
From: |
Ben Pfaff |
Subject: |
Re: Problem with output file on windows |
Date: |
Thu, 16 Jul 2009 21:12:59 -0700 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) |
michel <address@hidden> writes:
> I don't understand this:
>
> ... || strchr ("/\\", home_dir[strlen (home_dir) - 1]) != NULL)
> path = xasprintf ("%s%c", home_dir, '/');
>
> 'strchr' will return != NULL only if the last char on home_dir is either
> '/' or '\'. So the '/' will be put on 'path' only if there is alread one
> there and it should be the oposite. Am I missing something?
Yes, I noticed that soon afterward and changed != to ==.
> And since home_dir is being created with windows variables,
> there is no chance of it contains a slash, since windows only
> uses backslashs. Therefore, you could change 'strchr ("/\\",
> home_dir[strlen (home_dir) - 1]) != NULL' by home_dir[strlen
> (home_dir) - 1]) == '\'.
In my experience, Windows accepts both "/" and "\" in file names,
so I think that it is going to be more robust if we check for
both possibilities.
Does the version in pre5 work?
--
"I admire him, I frankly confess it; and when his time comes
I shall buy a piece of the rope for a keepsake."
--Mark Twain