WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#17494 closed enhancement (duplicate)

Directory Separator Constant

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

Description

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

Download all attachments as: .zip

Change History (4)

dragonflyeye3 years ago

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

comment:1 scribu3 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 3 years ago by scribu (previous) (diff)

comment:2 dragonflyeye3 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) . '/');

comment:3 nacin3 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.