Updated: Comment #130
drupal_get_path() infiltrates almost every module and isn't very intuitive for new developers. Stream wrappers make much more sense.
Replace drupal_get_path() with stream wrappers in strings that are evaluated for a module, theme or profile path.
Before patch examples:
drupal_add_css(drupal_get_path('module', 'theme_test') . '/css/base-override.css');
$render_array['#attached']['css'] = drupal_get_path('module', 'theme_test') . '/css/base-override.css';
After patch examples:
$render_array['#attached']['css'] = 'module://theme_test/css/base-override.css';
Consensus is to go with the suggested module:// theme:// and profile:// suggested.
Needs a reroll
Needs to pass tests
Would be nice, but not a requirement to be able to script replacement of 90% of drupal_get_path calls to not increase amount of novice issue tasks
Simplifies getting paths to modules, themes and profiles by using a stream wrapper.
Original report by @Dave Reid
I wrote http://drupal.org/project/system_stream_wrapper and now let's merge it into core! It's super helpful to be able to access files via module://modulename/path/to/file.txt which nicely resolves to the actual file location.
|FAILED: [[SimpleTest]]: [MySQL] 48,360 pass(es), 3,319 fail(s), and 1,913 exception(s).|
|FAILED: [[SimpleTest]]: [MySQL] Drupal installation failed.|
|FAILED: [[SimpleTest]]: [MySQL] 47,056 pass(es), 3,294 fail(s), and 1,893 exception(s).|