Link to user Public Directory

oldteacher

Active member
Stuck, out of ideas 🙂

I know I can use the following in script to get Public/Public Documents:
Code:
function GetPublicDocPath: String;
begin
Result := GetSpecialFolderPath(46);
end;
And $path = exo_return_hescriptcom ('UserMain.GetPublicDocPath', '');

But what I need (or rather customer specifications) is get just the “Public” directory.

To be clear, I need to use C or system drive:\Users\Public

Please help me out.

Not sure how to use this information, but basically what I need:

In Windows Vista and later the documents, music and video folders were moved out of the %ALLUSERSPROFILE% folder and placed in a new folder called Public (“c:\Users\Public”) and can be found with %PUBLIC% . CSIDL_COMMON_APPDATA also got a environment variable called %ProgramData% and because most of the other folders moved to %PUBLIC% it was decided that %ALLUSERSPROFILE% did not need the Application Data subfolder so %ProgramData% is the same as %ALLUSERSPROFILE% .
 
Last edited:
Hi @oldteacher, you might want to check this Environment.SpecialFolder Enum (System) | Microsoft Docs for SpecialFolder enum.

Sorry, I’ve been pretty busy lately. I just tried your code above. You can also just go up one folder after reaching Public Documents via php by doing: $public = realpath($path . ‘/…’); then echo $public; to check.

Ps : It’s ‘/2 dots’, the editor seems to add 1 more dot.

Regards!
 
Last edited:
Thank you @Wukong, really appreciate your input. Unfortunately there is no equivalent in the Environment.SpecialFolder Enum. Had reviewed those docs prior.

I will try your
Wukong said:
$public = realpath($path . '/..'); and echo $public;
Thank you again!

Update: just tried and works fine!
 
Last edited:
Back
Top