Home » System » System_Folders » Bug #9513
Documents for windows users is not always set to proper directory
Details
| Submitted | 2006-11-30 22:05 UTC |
|---|---|
| From | auroraeosrose at php dot net |
| Assigned | cweiske |
| Status | Closed |
| Package | System_Folders |
| PHP Version | 5.2.0 RC4 |
| OS | WinXPSP2 |
| 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);