I want to open a FileDialog window into the user home folder (i.e. /home/user or /Users/unsername)
I read the user home folder, using System.getProperty:
String homefolder = System.getProperty(user.home);
And the variable containts the correct home folder. But when i set the filterpath in FileDialog, it opens (in linux) only the /home level not entering into the user home dir.
This is the source code:
FileDialog dialog = new FileDialog(shell);
dialog.setText("Choose a certificate");
String platform = SWT.getPlatform();
String homefolder = System.getProperty("user.home");
dialog.setFilterPath(homefolder);
Any idea?
Here a screenshot:
Your code works perfectly with SWT 3.6.1. There is a bug report here stating that this was a problem in SWT versions <= 3.3 and was fixed in 3.4.
So, the solution would be to install a never version (ideally the current version).
Since you mentioned that you use a Maven repository, there is one for SWT 3.8 here:
maven project: SWT 3.5 dependency: any official public repo?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With