Skip to content

Commit

Permalink
Added possibility to define file chooser directory
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborbata committed Sep 2, 2022
1 parent 320013d commit d694794
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 7 deletions.
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ Features:

Usage
-----
Java 8 or later is recommended to run JPass. Most platforms have a mechanism to execute `.jar` files (e.g. double click the `jpass-0.1.26-RELEASE.jar`).
You can also run the application from the command line by typing (the password file is optional):
Java 8 or later is recommended to run JPass.
You can run the application from the command line by typing (the password file is optional):

java -jar jpass-0.1.26-RELEASE.jar [password_file]

Download
--------
You can find the latest distribution package under the [releases](https://github.com/gaborbata/jpass/releases) link.
You can find the latest distribution packages under the [releases](https://github.com/gaborbata/jpass/releases) link.

On Windows, you can install JPass using [scoop](https://scoop.sh/).

```
scoop install jpass.json
```

How to compile
--------------
Expand All @@ -47,6 +53,7 @@ Default configurations can be overridden in `jpass.properties` file:
| default.password.generation.length | integer | 14 |
| date.format | string | yyyy-MM-dd |
| entry.details | list | TITLE,MODIFIED |
| file.chooser.directory | string | ./ |

Contributors
------------
Expand Down
32 changes: 32 additions & 0 deletions jpass.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": "0.1.26",
"description": "Password manager application with strong encryption (AES-256)",
"homepage": "https://github.com/gaborbata/jpass",
"license": "MIT",
"architecture": {
"64bit": {
"url": "https://github.com/gaborbata/jpass/releases/download/v0.1.26/jpass-0.1.26-windows-x64.zip",
"hash": "df5cd27c0163e830d7d94793825cb3ff907ecf1ef630fd716a7f8fe6fc979c2e"
}
},
"bin": "jpass.exe",
"shortcuts": [
[
"jpass.exe",
"JPass"
]
],
"checkver": {
"github": "https://github.com/gaborbata/jpass"
},
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://github.com/gaborbata/jpass/releases/download/v$version/jpass-$version-windows-x64.zip"
}
},
"hash": {
"url": "$baseurl/checksums.txt"
}
}
}
4 changes: 4 additions & 0 deletions src/main/config/jpass.properties
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,7 @@ entry.details=TITLE,MODIFIED
# Z | Time zone | -0800
# X | Time zone | -08; -0800; -08:00
date.format=yyyy-MM-dd

# Directory to be used for file chooser dialogs. (default: ./)
# Leave that property empty to use the system default directory.
file.chooser.directory=./
6 changes: 3 additions & 3 deletions src/main/dist/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ Features:

Usage
-----
Java 8 or later is recommended to run JPass. Most platforms have a mechanism
to execute `.jar` files (e.g. double click the `jpass-0.1.26-RELEASE.jar`).
You can also run the application from the command line by typing (the password
Java 8 or later is recommended to run JPass.
You can run the application from the command line by typing (the password
file is optional):

java -jar jpass-0.1.26-RELEASE.jar [password_file]
Expand All @@ -34,6 +33,7 @@ Default configurations can be overridden in `jpass.properties` file:
| default.password.generation.length | integer | 14 |
| date.format | string | yyyy-MM-dd |
| entry.details | list | TITLE,MODIFIED |
| file.chooser.directory | string | ./ |

License
-------
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/jpass/ui/helper/FileHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import jpass.data.EntriesRepository;
import jpass.ui.JPassFrame;
import jpass.ui.action.Worker;
import jpass.util.Configuration;

import static jpass.ui.MessageDialog.showPasswordDialog;
import static jpass.ui.MessageDialog.showWarningMessage;
Expand Down Expand Up @@ -365,7 +366,8 @@ protected Void doInBackground() throws Exception {
*/
private static File showFileChooser(JPassFrame parent, String taskName, String extension, String description) {
File ret = null;
JFileChooser fc = new JFileChooser("./");
String fileChooserDir = Configuration.getInstance().get("file.chooser.directory", "./");
JFileChooser fc = new JFileChooser(fileChooserDir.isEmpty() ? null : fileChooserDir);
fc.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
Expand Down

0 comments on commit d694794

Please sign in to comment.