Hello Everyone,

Another thread here made me want to raise a question of best practices when
defining directory paths - it really applies both in Cake and in general.

I notice that the Cake convention when defining paths is to create a
concatenated string for the path using the "DS" constant for each directory
separator in the path.  An example, selectively copied from a post in
another thread:

if (!defined('ROOT')) {
        define('ROOT', 'C:'.DS.'wamp'.DS.'apps');
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
        define('CAKE_CORE_INCLUDE_PATH', 'C:'.DS.'wamp'.DS.'cake' );
}

I completely understand why it's important to use the DS constant for
"self-discovery" paths that are generated on-the-fly on many platforms (like
the Cake core).  However, when defining these absolute paths, which
obviously do not cross platforms anyways, what is the benefit of this
convention?

Using continuous strings, the values are much more readable and also easier
to change:

if (!defined('ROOT')) {
        define('ROOT', 'C:\wamp\apps');
}
if (!defined('CAKE_CORE_INCLUDE_PATH')) {
        define('CAKE_CORE_INCLUDE_PATH', 'C:\wamp\cake' );
}

What am I missing?

Rhett


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to