Re: Function to do runtime relative directory mapping

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: Function to do runtime relative directory mapping
Дата
Msg-id 1659.24.211.141.25.1083844209.squirrel@www.dunslane.net
обсуждение исходный текст
Ответ на Re: Function to do runtime relative directory mapping  (reina_ga@hotmail.com (Tony Reina))
Список pgsql-patches
Tony Reina said:
> pgman@candle.pha.pa.us (Bruce Momjian) wrote in message >   extern void
> canonicalize_path(char *path);
>> + #ifndef WIN32
>> + #define ISSEP(c)    ((c) == '/')
>> + #else
>> + #define ISSEP(c)    ((c) == '/' || (c) == '\\')
>> + #endif
>
>
> I've seen references to this "canonicalization" of the Windows \
> character for the win32 port. I don't claim to be a programming guru,
> but I recently read Jeff Cogswell's C++ for Dummies and he says (p. 546
> "Separating a path name") that you can use Unix-style / to
> separate directories in your programming and Windows will know what to
> do. In other words, you don't need \\ to separate directory names. /
> should work just fine.
>
> Perhaps MinGW and the gcc compiler on Windows behaves differently(?)
>
> Then again, perhaps there are other factors that I'm not considering.
>

It has nothing to do with the compiler - it's a function of the underlying
MSVCRT library. And you are correct. See initdb.c for an example - after
canonicalising it can and does happily use / as the separator. The only
trouble you have is in dealing with Windows command interpreters, when you
have to make sure that you quote the path (you have to do that anyway, as
the path might also include spaces).

cheers

andrew



В списке pgsql-patches по дате отправления:

Предыдущее
От: reina_ga@hotmail.com (Tony Reina)
Дата:
Сообщение: Re: Function to do runtime relative directory mapping
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Dollar Quoting doc patch--resend.