[Fedora-directory-devel] cleaning up FILE_PATHSEP?
Andrew Bartlett
abartlet at samba.org
Mon May 21 02:46:43 UTC 2007
I recently began work on bug 239765, and came across the wonder of
FILE_PATHSEP:
#ifdef XP_UNIX
#define FILE_PATHSEP '/'
#define FILE_PATHSEPP "/"
#define FILE_PARENT "../"
#define WSACleanup()
#elif defined(XP_WIN32)
#define FILE_PATHSEP '/'
#define FILE_PATHSEPP "\\\\"
#define FILE_PARENT "..\\"
#endif /* XP_WIN32 */
Firstly, what little I knew about windows file handling told me that we
could, at least on the supply side, use a unix /.
Indeed, I noted that much of create_instance does exactly that *and*
passes in FILE_PATHSEP via %c. If we needed FILE_PATHSEP, then this
would already be a problem:
/* generate <confdir>/slapd-collations.conf */
PR_snprintf(src, sizeof(src), "%s%c%s%c/config/%s-collations.conf",
cf->sysconfdir, FILE_PATHSEP, cf->package_name,
FILE_PATHSEP, PRODUCT_NAME);
PR_snprintf(dest, sizeof(dest), "%s%c%s-collations.conf",
cf->config_dir, FILE_PATHSEP, PRODUCT_NAME);
Even more priceless is the use of FILE_PATHSEP in
ldap/admin/src/configure_instance.cpp:create_console_script(). (is
there a /bin/sh that doesn't accept / as a path?).
Anyway, for my own amusement, I'll post a patch (probably untested on
win32) to make this a little easier on the eyes, and perhaps even easier
on new programmers to the codebase.
Thoughts?
Andrew Bartlett
--
Andrew Bartlett http://samba.org/~abartlet/
Authentication Developer, Samba Team http://samba.org
Samba Developer, Red Hat Inc. http://redhat.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <http://listman.redhat.com/archives/fedora-directory-devel/attachments/20070521/2c7d3198/attachment.sig>
More information about the Fedora-directory-devel
mailing list