michel <[email protected]> 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


_______________________________________________
pspp-dev mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/pspp-dev

Reply via email to