I’ve got a gtk file chooser button on my application I am writing in c# using Mono Develop. I would like to set the file chooser’s default location to the users’ home directory regardless of what user is running it.
I’ve tried the ~/ short cut – fchFolder1.SetCurrentFolder(“~/”); – but this did not work. I was just wondering if there was a value that the gtk file chooser used to refer to the users home directory? Thanks
In Unix, you can either get the HOME environment variable or use
System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal).In Windows, expand
%HOMEDRIVE%%HOMEPATH%to get the “home” directory, or use the sameGetFolderPathcall to get the “My Documents” directory.Discussion about the HOME and HOMEDRIVE+HOMEPATH approach: Getting the path of the home directory in C#?