Support for 'single-instance' when app is started in folder

Fix #515