Hi All,
Any ideas on how to programmatically get the Servoy Server installation directory?
I can do something with the java.lang.System class to get the runtime location, but that is client-based
Thanks,
Sean
Hi All,
Any ideas on how to programmatically get the Servoy Server installation directory?
I can do something with the java.lang.System class to get the runtime location, but that is client-based
Thanks,
Sean
You can use the headless client plugin to get server side.
Call a method that returns:
java.lang.System.getProperty("user.dir");
Thanks Joas,
This will consume a license. Good for business!
But I was hoping there was something in our API that we could use.
Any other Ideas?
Sean
Yes, it will cost you one license, but only for a split second. And once you have the path, you can save it somewhere until the end of time.
An alternative would be to create a client-server plugin, but that’s even more overkill.
I can’t think of any simpler way to do this.
What is actually the usecase for this?
The use case is that tenant resources will be stored in folders under the installation dir.
Would be nice to have something like
var file = application.getServoyHome()
But even if you do, then you still need a way to get the files in that folder or to read them back.
the outside world (especially smart clients which are really outside of the server instance) shouldn’t have any knowledge what the installation directory of the application server is
This is just a big no go! and could potentially be a big security hole,
If you want to store stuff on the server from smartclients (or even webclients) then always just use relative paths. And what the starting dir is is defined at the server not by a client.
This is how for example the File plugin works with its stream to server methods.