Get the last selected directory

On 24/09/2017 at 03:03, xxxxxxxx wrote:

User Information:
Cinema 4D Version:   R18 
Platform:   Windows  ;   
Language(s) :     C++  ;


Every time I create an Xbitmap shader in a material, I get the "Open File" dialog to select an image.
This dialog shows to the last selected directory. How do I get that "Last Selected Directory" ?
Is there a way such as GeGetC4DPath(C4D_PATH_DESKTOP) or do I have to manually save the last-selected-directory in Preferences ?

Thank you.

On 26/09/2017 at 08:52, xxxxxxxx wrote:

Hi Peterakos, thanks for writing us.

The information is already stored in the world settings container but accessing this data is not officially supported resulting it more as an hack rather than an official approach.

To access it use ID 90001.

BaseContainer* worldSettings = GetWorldContainer();  
if (worldSettings)  
  Filename lastSelectedDir = worldSettings.GetFilename(90001)  

Best, Riccardo

On 28/09/2017 at 05:55, xxxxxxxx wrote:

Hello and thank you for your help.

Can I also set 90001 filename to the preferred directory ? Does Cinema 4D use the same directory to load and save files ?

Thank you !