From 535f2afe907219143489d411836e3987c453f27d Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 19 Sep 2017 10:55:16 +0200 Subject: [PATCH] init: prompt user for Android SDK path using platform-specific default --- fdroidserver/init.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/fdroidserver/init.py b/fdroidserver/init.py index 0067ffcd..3aa0b61a 100644 --- a/fdroidserver/init.py +++ b/fdroidserver/init.py @@ -100,11 +100,21 @@ def main(): # make sure at least aapt is found, since this can't do anything without it test_config['aapt'] = common.find_sdk_tools_cmd('aapt') else: - # if neither --android-home nor the default sdk_path exist, prompt the user + # if neither --android-home nor the default sdk_path + # exist, prompt the user using platform-specific default default_sdk_path = '/opt/android-sdk' if sys.platform == 'win32' or sys.platform == 'cygwin': - default_sdk_path = os.path.join(os.getenv('USERPROFILE'), - 'AppData', 'Local', 'Android', 'android-sdk') + p = os.path.join(os.getenv('USERPROFILE'), + 'AppData', 'Local', 'Android', 'android-sdk') + elif sys.platform == 'darwin': + # on OSX, Homebrew is common and has an easy path to detect + p = '/usr/local/opt/android-sdk' + else: + # if the Debian packages are installed, suggest them + p = '/usr/lib/android-sdk' + if os.path.exists(p): + default_sdk_path = p + while not options.no_prompt: try: s = input(_('Enter the path to the Android SDK (%s) here:\n> ') % default_sdk_path)