PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » System » System_Folders » Bug #9513

Documents for windows users is not always set to proper directory

Details

Submitted2006-11-30 22:05 UTC
Fromauroraeosrose at php dot net
Assignedcweiske
StatusClosed
PackageSystem_Folders
PHP Version5.2.0 RC4
OSWinXPSP2
Roadmaps(Not assigned)

Comments

[2006-11-30 22:05 UTC] auroraeosrose at php dot net

Description:
------------
Currently the documents lookup searches for a "My Documents" folder in the user profile directory, however that folder can be moved arbitrarily by the user. The foolproof way to detect the my documents folder on windows is to use COM - you can get other windows "special folders" in the same way. According to the http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/14761fa3-19be-4742-9f91-23b48cd9228f.asp
msdn docs, if a folder doesn't exist the request returns an empty string.

One caveat though is they must have the windows scripting host on their computer and enabled to use the feature. But this is the default setup.

Test script:
---------------
$shell = new COM('WScript.Shell');
$documents = $shell->SpecialFolders('MyDocuments');
unset($shell);