Prevents starting a second instance of the GUI and forwards

main-method-arguments to the running instance. Command line arguments
are treated by showing the corresponding folder in the GUI.

If an argument is a folder, it is shown directly. If an argument is a
.masterkey.json file, the parent directory is shown. If an argument does
not exist, but the folder can be created, the newly created folder is
shown.

It was necessary to move the main function away from the MainApplication
class because running the main method of a class, which extends the
javafx Application class, will start a non-daemon thread. This prevents
the VM from exiting naturally.

OSX needs its own mechanism, which is implemented in OS-specific code.
It is vital that the required handler is added in the main thread of the
application, not the Java FX thread, which is a bit awkward to
implement. Since it is possible to open .cryptomator packages on OSX,
this extension is now hidden in the folder list.
This commit is contained in:
Tillmann Gaida
2015-01-21 17:35:25 +01:00
parent ecf29a91b8
commit 0cfc3fb7f7
12 changed files with 963 additions and 12 deletions
@@ -63,4 +63,8 @@ interface FileNamingConventions {
*/
PathMatcher ENCRYPTED_FILE_GLOB_MATCHER = FileSystems.getDefault().getPathMatcher("glob:**/*{" + BASIC_FILE_EXT + "," + LONG_NAME_FILE_EXT + "}");
/**
* On OSX, folders with this extension are treated as a package.
*/
String FOLDER_EXTENSION = ".cryptomator";
}