mirror of
https://github.com/StevenBlack/hosts.git
synced 2024-07-07 13:02:27 +02:00
Merge pull request #45 from hd074/master
hotfix for duplicates and artefacts
This commit is contained in:
commit
e35ca1ecae
@ -93,6 +93,7 @@ def main():
|
|||||||
promptForUpdate()
|
promptForUpdate()
|
||||||
promptForExclusions()
|
promptForExclusions()
|
||||||
mergeFile = createInitialFile()
|
mergeFile = createInitialFile()
|
||||||
|
removeOldHostsFile()
|
||||||
finalFile = removeDupsAndExcl(mergeFile)
|
finalFile = removeDupsAndExcl(mergeFile)
|
||||||
finalizeFile(finalFile)
|
finalizeFile(finalFile)
|
||||||
updateReadme(numberOfRules)
|
updateReadme(numberOfRules)
|
||||||
@ -321,6 +322,12 @@ def moveHostsFileIntoPlace(finalFile):
|
|||||||
elif (os.name == 'nt'):
|
elif (os.name == 'nt'):
|
||||||
print ('Automatically moving the hosts file in place is not yet supported.')
|
print ('Automatically moving the hosts file in place is not yet supported.')
|
||||||
print ('Please move the generated file to %SystemRoot%\system32\drivers\etc\hosts')
|
print ('Please move the generated file to %SystemRoot%\system32\drivers\etc\hosts')
|
||||||
|
|
||||||
|
def removeOldHostsFile(): # hotfix since merging with an already existing hosts file leads to artefacts and duplicates
|
||||||
|
oldFilePath=os.path.join(BASEDIR_PATH,'hosts')
|
||||||
|
open(oldFilePath, 'a').close() # create if already removed, so remove wont raise an error
|
||||||
|
os.remove(oldFilePath);
|
||||||
|
open(oldFilePath, 'a').close() # create new empty hostsfile
|
||||||
|
|
||||||
# End File Logic
|
# End File Logic
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user