Re: [Fedora-directory-devel] cleaning up FILE_PATHSEP?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Andrew Bartlett wrote:
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 /.
Yes. For modern versions of Windows. This may have been an artifact of Win95/98/NT, or perhaps cases where these paths were passed to a command interpreter (e.g. in a system() call).
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);
It probably doesn't matter anymore now that modern versions of Windows support both \ and /.
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?).
Probably not anymore, if there ever was one that had a problem.
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?
FILE_PATHSEP is used throughout fedora ds code . . .
Andrew Bartlett

------------------------------------------------------------------------

--
Fedora-directory-devel mailing list
Fedora-directory-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-directory-devel

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

--
Fedora-directory-devel mailing list
Fedora-directory-devel@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/fedora-directory-devel

[Index of Archives]     [Fedora Directory Announce]     [Fedora Users]     [Older Fedora Users Mail]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Review]     [Fedora Art]     [Fedora Music]     [Fedora Packaging]     [CentOS]     [Fedora SELinux]     [Big List of Linux Books]     [KDE Users]     [Fedora Art]     [Fedora Docs]

  Powered by Linux