From 77944939525a7b86dd33171eaee733244ef1a10d Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Fri, 20 Apr 2012 08:02:12 -0400 Subject: [PATCH] Don't try to expand path for None values --- library/copy | 9 ++++++--- library/file | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/library/copy b/library/copy index ef6c30a6b66..b5a52647a95 100755 --- a/library/copy +++ b/library/copy @@ -40,9 +40,12 @@ for x in items: (k, v) = x.split("=") params[k] = v -src = os.path.expanduser(params['src']) -dest = os.path.expanduser(params['dest']) - +src = params['src'] +dest = params['dest'] +if src: + src = os.path.expanduser(src) +if dest: + dest = os.path.expanduser(dest) # raise an error if there is no src file if not os.path.exists(src): diff --git a/library/file b/library/file index 2922c3d0803..b672934e4ee 100755 --- a/library/file +++ b/library/file @@ -88,8 +88,12 @@ for x in items: params[k] = v state = params.get('state','file') -path = os.path.expanduser(params.get('path', params.get('dest', params.get('name', None)))) -src = os.path.expanduser(params.get('src', None)) +path = params.get('path', params.get('dest', params.get('name', None))) +if path: + path = os.path.expanduser(path) +src = params.get('src', None) +if src: + path = os.path.expanduser(src) dest = params.get('dest', None) mode = params.get('mode', None) owner = params.get('owner', None)