WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#15598 closed enhancement (worksforme)

Use DIRECTORY_SEPARATOR for file paths instead of '/'

Reported by: jazzmind Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: General Keywords: needs-patch
Focuses: Cc:

Description

Unix directory path separators ('/') are hardcoded in throughout theme.php and perhaps other files. As a result, when running wordpress off a Windows system and using alternative theme directories (via register_theme_directory()) a "theme broken" error is thrown because the code can't find files within the theme path.

If the same theme is moved into the normal themes directory, everything works fine. If the code is run on a unix system, everything also works fine.

Change History (5)

comment:1 alex-ye3 years ago

  • Keywords DIRECTORY_SEPARATOR added

comment:2 Denis-de-Bernardy3 years ago

  • Component changed from Themes to General
  • Keywords needs-patch added; DIRECTORY_SEPARATOR removed
  • Milestone changed from Awaiting Review to Future Release
  • Severity changed from major to normal

comment:3 Denis-de-Bernardy3 years ago

  • Type changed from defect (bug) to enhancement

comment:4 scribu3 years ago

An alternative solution would be to make the register_theme_directory() and related functions check both / and \.

comment:5 dd323 years ago

  • Milestone Future Release deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Using DIRECTORY_SEPERATOR clutters the code to me IMO, Using / is so much simpler given it's supported on both Windows and Unix systems.

We use str_replace('\\', '/'.. quite often in functions such as register_activation_hook

If there is anywhere that does not work well with Windows filepaths, please file a bug report for the individual issue.

Note: See TracTickets for help on using tickets.