diff --git a/web/config.py b/web/config.py index 00fc5e447..c4d6ab9e5 100644 --- a/web/config.py +++ b/web/config.py @@ -270,8 +270,13 @@ STORAGE_DIR = os.path.join( # expected to be overridden by packagers in config_distro.py. # # A default location can be specified for each database driver ID, in -# a dictionary. A relative (to the working directory for the package) -# location may be specified, or absolute. +# a dictionary. Either an absolute or relative path can be specified. +# In cases where it may be difficult to know what the working directory +# is, "$DIR" can be specified. This will be replaced with the path to the +# top-level pgAdmin4.py file. For example, on macOS we might use: +# +# $DIR/../../SharedSupport +# ########################################################################## DEFAULT_BINARY_PATHS = { "pg": "", diff --git a/web/pgadmin/browser/server_groups/servers/types.py b/web/pgadmin/browser/server_groups/servers/types.py index 9488e2032..3f9d484f2 100644 --- a/web/pgadmin/browser/server_groups/servers/types.py +++ b/web/pgadmin/browser/server_groups/servers/types.py @@ -7,7 +7,7 @@ # ########################################################################## -import os +import os, sys from flask import render_template from flask_babel import gettext as _ @@ -94,7 +94,7 @@ class ServerType(object): reverse=True ) - def utility(self, operation, sverion): + def utility(self, operation, sversion): res = None if operation == 'backup': @@ -112,10 +112,12 @@ class ServerType(object): )) ) - return os.path.join( - self.utility_path.get(), + bin_path = self.utility_path.get().replace("$DIR", os.path.dirname(sys.modules['__main__'].__file__)) + + return os.path.abspath(os.path.join( + bin_path, (res if os.name != 'nt' else (res + '.exe')) - ) + )) # Default Server Type