mirror of
https://github.com/StevenBlack/hosts.git
synced 2024-07-04 19:46:02 +02:00
Check if 'hosts' file exists
We need to check that the file exists before trying to update it, and if it doesn't we try to create an empty 'hosts' file.
This commit is contained in:
parent
80dcdfe00c
commit
0b0988eeef
|
@ -102,6 +102,15 @@ def main():
|
|||
|
||||
# Prompt the User
|
||||
def promptForUpdate():
|
||||
|
||||
# Create hosts file if it doesn't exists
|
||||
if not os.path.isfile(os.path.join(BASEDIR_PATH, 'hosts')):
|
||||
try:
|
||||
file = open(os.path.join(BASEDIR_PATH, 'hosts'), 'w+').close()
|
||||
except:
|
||||
printFailure("ERROR: No 'hosts' file in the folder, try creating one manually")
|
||||
sys.exit()
|
||||
|
||||
response = query_yes_no("Do you want to update all data sources?")
|
||||
if (response == "yes"):
|
||||
updateAllSources()
|
||||
|
|
Loading…
Reference in New Issue
Block a user