From 40f6e67d83a59e386517e121b397d9a11e7fecd8 Mon Sep 17 00:00:00 2001 From: junbo Date: Thu, 19 Jul 2018 18:11:59 +0800 Subject: [PATCH] fix issue 87 --- src/app.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app.py b/src/app.py index e431e7e..0ba0b47 100644 --- a/src/app.py +++ b/src/app.py @@ -50,7 +50,7 @@ def convert_str_to_bool(str: str) -> bool: def is_initialized() -> bool: - return os.path.exists(INIT_FILE) + return not os.path.exists(INIT_FILE) def finish_initialization(): @@ -196,8 +196,9 @@ def run(): avd_name = '{device}_{version}'.format(device=device.replace(' ', '_').lower(), version=ANDROID_VERSION) logger.info('AVD name: {avd}'.format(avd=avd_name)) + is_first_run = is_initialized() - if not is_initialized(): + if is_first_run: logger.info('Preparing emulator...') prepare_avd(device, avd_name) finish_initialization() @@ -207,7 +208,7 @@ def run(): with open("/root/android_emulator/config.ini", "a") as cfg: cfg.write('\ndisk.dataPartition.size={dp}'.format(dp=dp_size)) - if not is_initialized(): + if is_first_run: cmd = 'emulator/emulator @{name} -gpu off -verbose -wipe-data'.format(name=avd_name) else: cmd = 'emulator/emulator @{name} -gpu off -verbose'.format(name=avd_name)