Make WordPress Core

Opened 12 years ago

Closed 12 years ago

Last modified 12 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 12 years ago.
Patch file of wp-config-sample.php with new definition.

Download all attachments as: .zip

Change History (4)

12 years ago

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

#1 @scribu
12 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

Last edited 12 years ago by scribu (previous) (diff)

#2 @dragonflyeye
12 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
12 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.