Arch: changed download folder to use the macros folder pref setting

This commit is contained in:
Yorik van Havre 2014-04-24 18:53:06 -03:00
parent db72aa2a98
commit 79efe68e25

View File

@ -544,10 +544,14 @@ def mergeCells(objectslist):
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'''
macro path. Returns the path to the saved file'''
import urllib2, os
name = url.split('/')[-1]
filepath = os.path.join(FreeCAD.ConfigGet("UserAppData"),name)
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Macro")
macropath = p.GetString("MacroPath","")
if not macropath:
macropath = FreeCAD.ConfigGet("UserAppData")
filepath = os.path.join(macropath,name)
if os.path.exists(filepath) and not(force):
return filepath
try: