SWT Filedialog Open into home folder
Posted
by
Ivan
on Stack Overflow
See other posts from Stack Overflow
or by Ivan
Published on 2012-12-02T10:02:08Z
Indexed on
2012/12/02
11:04 UTC
Read the original article
Hit count: 304
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:
© Stack Overflow or respective owner