Setting default folder for FileSelect [SOLVED]



  • On 20/03/2015 at 03:05, xxxxxxxx wrote:

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

    ---------
    Hi,

    is it possible to set a custom default location when browsing for folders using Filename::FileSelect()?
    Tried to initialize the Filename object with it, but didn't work.
    It looks like it always opens the last selected folder (globally for all FileSelect() calls) by default. I wonder if it is a value that comes from the OS or is stored somewhere in Cinema 4D?

    Best,
    Satara



  • On 20/03/2015 at 09:17, xxxxxxxx wrote:

    Hello,

    actually it should be possible to define the default path:

      
    Filename fn;  
    fn.SetDirectory("C:\\myfolder");  
    fn.FileSelect(FILESELECTTYPE_ANYTHING,FILESELECT_DIRECTORY,"Load something");  
    

    Best wishes,
    Sebastian



  • On 20/03/2015 at 23:05, xxxxxxxx wrote:

    Hi Satara and Sebastian,

    this won't help much I know, but I've noticed that Cinema doesn't always open the file directory to what's been either hard-coded, or user set (e.g. via an editable string field). It can be quite annoying at times. I wonder if it's something to do with the preferences?

    WP.



  • On 23/03/2015 at 02:17, xxxxxxxx wrote:

    Thanks, Sebastian I previouly tried to assign the path directly to the filename and I guess this has been interpreted as a file instead of a directory path. Using Filename::SetDirectory() it works perfectly.

    @WickedP Maybe same "problem"?



  • On 23/03/2015 at 03:55, xxxxxxxx wrote:

    I've just had a peek, and I'm using SetDirectory() in the way Sebastian has shown.

    I compiled the object plugin again and went into Cinema to test it. The command is definitely opening a different directory. Even when a new build is made. It must be being stored in the prefs against the plugin id? The setting of the file string and suffix is fine. The directory itself though looks sus**ciously like the last place I had previously been, despite hard-coding the directory path in.

    Satara, if you open/save a file, and use the directory load/save multiple times, visiting other places to load from/save to, do you always get the hard-coded directory each time? Or does it change to one that's been previously visited?

    WP.


Log in to reply