From f84b113b5e44c2011f170025b924dd78edede10a Mon Sep 17 00:00:00 2001 From: Arne Augenstein Date: Sat, 24 Jan 2015 08:53:34 +0100 Subject: [PATCH 1/3] fixing handling of relative paths --- platformio/util.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platformio/util.py b/platformio/util.py index a5c015f3..0cfb389c 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -4,7 +4,7 @@ import json from os import name as os_name from os import getcwd, getenv, listdir, makedirs, utime -from os.path import dirname, expanduser, isdir, isfile, join, realpath +from os.path import dirname, expanduser, isdir, isfile, join, realpath, abspath from platform import system, uname from subprocess import PIPE, Popen @@ -51,7 +51,7 @@ def get_lib_dir(): config = get_project_config() if (config.has_section("platformio") and config.has_option("platformio", "lib_dir")): - lib_dir = config.get("platformio", "lib_dir") + lib_dir = abspath(config.get("platformio", "lib_dir")) if lib_dir.startswith("~"): return expanduser(lib_dir) else: From 87e1b09088b68102ee1d72c98b678781844db00b Mon Sep 17 00:00:00 2001 From: Arne Augenstein Date: Sat, 24 Jan 2015 16:04:53 +0100 Subject: [PATCH 2/3] sort imports --- platformio/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platformio/util.py b/platformio/util.py index 0cfb389c..fe850d0d 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -4,7 +4,7 @@ import json from os import name as os_name from os import getcwd, getenv, listdir, makedirs, utime -from os.path import dirname, expanduser, isdir, isfile, join, realpath, abspath +from os.path import abspath, dirname, expanduser, isdir, isfile, join, realpath from platform import system, uname from subprocess import PIPE, Popen From ef76822773be82a3f5c8570614c2aad50db58bfb Mon Sep 17 00:00:00 2001 From: Arne Augenstein Date: Sat, 24 Jan 2015 16:14:44 +0100 Subject: [PATCH 3/3] expand path first, then get absolute path --- platformio/util.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/platformio/util.py b/platformio/util.py index fe850d0d..83c3bdf3 100644 --- a/platformio/util.py +++ b/platformio/util.py @@ -51,11 +51,10 @@ def get_lib_dir(): config = get_project_config() if (config.has_section("platformio") and config.has_option("platformio", "lib_dir")): - lib_dir = abspath(config.get("platformio", "lib_dir")) + lib_dir = config.get("platformio", "lib_dir") if lib_dir.startswith("~"): - return expanduser(lib_dir) - else: - return lib_dir + lib_dir = expanduser(lib_dir) + return abspath(lib_dir) except NotPlatformProject: pass return join(get_home_dir(), "lib")