ABSPATH in Windows

I’m having a a pain in the head using the ABSPATH constant in Windows.
Addressing files and folders in Windows is usually done using the (forward-slash) character while for Linux the character would be / (backslash).
Unfortunately the ABSPATH in WordPress is defined with only Linux in mind (putting a / at the end of it).
I wonder if I can over-ride it’s definition since in wp-config.php it’s defined under an if clause which indicates it can be defined elsewhere.

Problem detalis:

Read More
  1. I’m running on localhost
  2. The problem is with the statpress-visitors internal addressing.

This is how it addresses the files:

ABSPATH . 'wp-content/plugins/' . dirname(plugin_basename(__FILE__)) . '/def/os.dat'

And this is what I get as output:

C:wampwwwwp/wp-content/plugins/statpress-visitors/def/os.dat

Related posts

Leave a Reply

1 comment

  1. Windows does support both styles of slashes in path.

    I am not sure if ABSPATH definition is safe to edit:

    • pro it’s in wp-config.php
    • con it’s says to not edit following above it

    Myself I just use it as is, or replace slashes to make them uniform when putting path together. If that doesn’t work for you please provide specific examples where this causes issues.