mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUACAMOLE-335: Use /etc/guacamole for GUACAMOLE_HOME if not overridden and ~/.guacamole does not exist.
This commit is contained in:
@@ -103,6 +103,7 @@ public class LocalEnvironment implements Environment {
|
|||||||
|
|
||||||
// Determine location of GUACAMOLE_HOME
|
// Determine location of GUACAMOLE_HOME
|
||||||
guacHome = findGuacamoleHome();
|
guacHome = findGuacamoleHome();
|
||||||
|
logger.info("GUACAMOLE_HOME is \"{}\".", guacHome.getAbsolutePath());
|
||||||
|
|
||||||
// Read properties
|
// Read properties
|
||||||
properties = new Properties();
|
properties = new Properties();
|
||||||
@@ -146,7 +147,8 @@ public class LocalEnvironment implements Environment {
|
|||||||
* Locates the Guacamole home directory by checking, in order:
|
* Locates the Guacamole home directory by checking, in order:
|
||||||
* the guacamole.home system property, the GUACAMOLE_HOME environment
|
* the guacamole.home system property, the GUACAMOLE_HOME environment
|
||||||
* variable, and finally the .guacamole directory in the home directory of
|
* variable, and finally the .guacamole directory in the home directory of
|
||||||
* the user running the servlet container.
|
* the user running the servlet container. If even the .guacamole directory
|
||||||
|
* doesn't exist, then /etc/guacamole will be used.
|
||||||
*
|
*
|
||||||
* @return The File representing the Guacamole home directory, which may
|
* @return The File representing the Guacamole home directory, which may
|
||||||
* or may not exist, and may turn out to not be a directory.
|
* or may not exist, and may turn out to not be a directory.
|
||||||
@@ -166,10 +168,19 @@ public class LocalEnvironment implements Environment {
|
|||||||
if (desiredDir != null)
|
if (desiredDir != null)
|
||||||
guacHome = new File(desiredDir);
|
guacHome = new File(desiredDir);
|
||||||
|
|
||||||
// If not explicitly specified, use ~/.guacamole
|
// If not explicitly specified, use standard locations
|
||||||
else
|
else {
|
||||||
|
|
||||||
|
// Try ~/.guacamole first
|
||||||
guacHome = new File(System.getProperty("user.home"), ".guacamole");
|
guacHome = new File(System.getProperty("user.home"), ".guacamole");
|
||||||
|
|
||||||
|
// If that doesn't exist, try /etc/guacamole if the /etc directory
|
||||||
|
// exists on this system
|
||||||
|
if (!guacHome.exists() && new File("/etc").exists())
|
||||||
|
guacHome = new File("/etc/guacamole");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Return discovered directory
|
// Return discovered directory
|
||||||
return guacHome;
|
return guacHome;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user