summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Alejandro <ivanalejandro0@yahoo.com.ar>2013-07-11 11:05:00 -0300
committerIvan Alejandro <ivanalejandro0@yahoo.com.ar>2013-07-11 11:05:00 -0300
commita64ab88bf440eea1312d87c7087dcae291d3ecd7 (patch)
tree79c9bd40a56bc8fb06d9028179904a61d327b920
parent4b7c319d3234ec40e4c2ca63204c0efbc0e55f37 (diff)
parenta74697bf19ba2e011a6f80b1ff859617f92ed6c2 (diff)
Merge remote-tracking branch 'chiiph/bug/osx_fix_icon_path' into develop
-rw-r--r--changes/bug_osx_fix_icon1
-rw-r--r--src/leap/services/eip/vpnlaunchers.py28
2 files changed, 23 insertions, 6 deletions
diff --git a/changes/bug_osx_fix_icon b/changes/bug_osx_fix_icon
new file mode 100644
index 00000000..7f8cfea6
--- /dev/null
+++ b/changes/bug_osx_fix_icon
@@ -0,0 +1 @@
+ o OSX: Fix icon display in cocoasudo. \ No newline at end of file
diff --git a/src/leap/services/eip/vpnlaunchers.py b/src/leap/services/eip/vpnlaunchers.py
index 116a8790..f031a6e5 100644
--- a/src/leap/services/eip/vpnlaunchers.py
+++ b/src/leap/services/eip/vpnlaunchers.py
@@ -497,6 +497,26 @@ class DarwinVPNLauncher(VPNLauncher):
to, frompath, to, to)
return cmd
+ def _get_resource_path(self):
+ """
+ Returns the absolute path to the app resources directory
+
+ :rtype: str
+ """
+ return os.path.abspath(
+ os.path.join(
+ os.getcwd(),
+ "../../Contents/Resources"))
+
+ def _get_icon_path(self):
+ """
+ Returns the absolute path to the app icon
+
+ :rtype: str
+ """
+ return os.path.join(self._get_resource_path(),
+ "leap-client.tiff")
+
def get_cocoasudo_ovpn_cmd(self):
"""
Returns a string with the cocoasudo command needed to run openvpn
@@ -505,9 +525,7 @@ class DarwinVPNLauncher(VPNLauncher):
:rtype: (str, list)
"""
- iconpath = os.path.abspath(os.path.join(
- os.getcwd(),
- "../../../Resources/leap-client.tiff"))
+ iconpath = self._get_icon_path()
has_icon = os.path.isfile(iconpath)
args = ["--icon=%s" % iconpath] if has_icon else []
args.append("--prompt=%s" % (self.SUDO_MSG,))
@@ -522,9 +540,7 @@ class DarwinVPNLauncher(VPNLauncher):
:rtype: (str, list)
"""
- iconpath = os.path.abspath(os.path.join(
- os.getcwd(),
- "../../../Resources/leap-client.tiff"))
+ iconpath = self._get_icon_path()
has_icon = os.path.isfile(iconpath)
args = ["--icon=%s" % iconpath] if has_icon else []
args.append("--prompt=%s" % (self.INSTALL_MSG,))