Arch: Added dxflib autoupdate mechanism - fixes #0001301

This commit is contained in:
Yorik van Havre
2013-11-10 16:45:34 -02:00
parent 23eb4c7a08
commit 40d5a5462f
2 changed files with 30 additions and 16 deletions

View File

@@ -535,13 +535,13 @@ def mergeCells(objectslist):
FreeCAD.ActiveDocument.recompute()
return base
def download(url):
def download(url,force=False):
'''downloads a file from the given URL and saves it in the
user directory. Returns the path to the saved file'''
import urllib2, os
name = url.split('/')[-1]
filepath = os.path.join(FreeCAD.ConfigGet("UserAppData"),name)
if os.path.exists(filepath):
if os.path.exists(filepath) and not(force):
return filepath
try:
FreeCAD.Console.PrintMessage("downloading "+url+" ...\n")