Make WordPress Core

Opened 13 years ago

Closed 13 years ago

Last modified 13 years ago

#17494 closed enhancement (duplicate)

Directory Separator Constant

Reported by: dragonflyeye's profile dragonflyeye Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords:
Focuses: Cc:


Other platforms I've used define a Directory Separator (/ or \, based on platform) in their configuration files so that developers don't have to try to write parallel code for different platforms. It doesn't appear WordPress actually uses this, but it seems like a simple thing to include into the wp-config.php file.

Attachments (1)

wp-config-sample.patch (402 bytes) - added by dragonflyeye 13 years ago.
Patch file of wp-config-sample.php with new definition.

Download all attachments as: .zip

Change History (4)

13 years ago

Patch file of wp-config-sample.php with new definition.

#1 @scribu
13 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Just defining a constant without using it in core is pointless.

More so, PHP already comes with DIRECTORY_SEPARATOR, which has been suggested before: #15598

Version 0, edited 13 years ago by scribu (next)

#2 @dragonflyeye
13 years ago

Well, using it in the core would be the point, wouldn't it? Didn't realize I'd have to create a patch with every single change across the entire system in it.

As for DIRECTORY_SEPARATOR, that's all well and good, but even the basic wp-config.php file doesn't make use of it, as in this:
define('ABSPATH', dirname(FILE) . '/');

#3 @nacin
13 years ago

There's no need. Windows works fine. DIRECTORY_SEPARATOR is much better for say, exploding a path received from Windows. And sometimes we do take that into account when working off __FILE__, see plugin_basename() for example. But building paths don't require that at all.

Note: See TracTickets for help on using tickets.