Fix bug with first-launching

This commit is contained in:
Ivan Kravets
2014-08-04 11:09:47 +03:00
parent 2534db8c0e
commit f7a4ee0d66

View File

@ -1,8 +1,8 @@
# Copyright (C) Ivan Kravets <me@ikravets.com> # Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details. # See LICENSE for details.
from os import listdir from os import listdir, makedirs
from os.path import getmtime, isfile, join from os.path import getmtime, isdir, isfile, join
from sys import exit as sys_exit from sys import exit as sys_exit
from time import time from time import time
from traceback import format_exc from traceback import format_exc
@ -47,6 +47,8 @@ def autocheck_latest_version():
checkfile = join(get_home_dir(), ".pioupgrade") checkfile = join(get_home_dir(), ".pioupgrade")
if isfile(checkfile) and getmtime(checkfile) > (time() - check_interval): if isfile(checkfile) and getmtime(checkfile) > (time() - check_interval):
return False return False
if not isdir(get_home_dir()):
makedirs(get_home_dir())
with open(checkfile, "w") as f: with open(checkfile, "w") as f:
f.write(str(time())) f.write(str(time()))
return get_latest_version() != __version__ return get_latest_version() != __version__