This code

return $this->var1 .DS. $this->var2;

won't work on Windows (XP) while it does on Mac OS. ('DS' is defined as DIRECTORY_SEPARATOR.)

If I change the code, that is change DS with "/",

return $this->var1 ."/". $this->var2;

then it works.

Why doesn't it work (or where am I mistaking🙂)? Would really like to use DS in place of "/".

    How/where is DS defined? Does it work if you replace it with the built-in DIRECTORY_SEPARATOR constant?

      in your general config/constants/functions file, whichever you use, that is called first by every file you plan to use this in, add:

      if ( !defined( 'DS' ) )
        define( 'DS', DIRECTORY_SEPARATOR );
      

      and see if that fixes it - as it sounds like it's not really defined.

        Note also that on Windows, DIRECTORY_SEPARATOR is "\"; so if you're using DS/DIRECTORY_SEPARATOR in some places and there are "/" hanging around in others, strings that should match might not.

        Of course, this depends on what is meant by "won't work".

          Note also that on Windows, DIRECTORY_SEPARATOR is "\"; so if you're using DS/DIRECTORY_SEPARATOR in some places and there are "/" hanging around in others, strings that should match might not.

          Of course, this depends on what is meant by "won't work".

            Write a Reply...