From f50380af7350f972f26a55947e42d446f3511cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Cesar=20Caballero=20D=C3=ADaz?= Date: Mon, 30 Apr 2018 14:17:44 -0400 Subject: [PATCH] #1911 NEWINSTALL file unlink issue --- gluon/fileutils.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gluon/fileutils.py b/gluon/fileutils.py index 0fa29acf..c1644be7 100644 --- a/gluon/fileutils.py +++ b/gluon/fileutils.py @@ -264,13 +264,20 @@ def w2p_pack(filename, path, compiled=False, filenames=None): def create_welcome_w2p(): - if not os.path.exists('welcome.w2p') or os.path.exists('NEWINSTALL'): + is_newinstall_file = os.path.exists('NEWINSTALL') + if not os.path.exists('welcome.w2p') or is_newinstall_file: try: w2p_pack('welcome.w2p', 'applications/welcome') - os.unlink('NEWINSTALL') logging.info("New installation: created welcome.w2p file") except: logging.error("New installation error: unable to create welcome.w2p file") + return + if is_newinstall_file: + try: + os.unlink('NEWINSTALL') + logging.info("New installation: removed NEWINSTALL file") + except: + logging.error("New installation error: unable to remove NEWINSTALL file") def w2p_unpack(filename, path, delete_tar=True):