From df6545ee4e3b40d38440b2e9316b5be4c0b4f6e2 Mon Sep 17 00:00:00 2001 From: Stephen Warren Date: Mon, 20 Jan 2014 15:22:14 -0700 Subject: Make all paths absolute Convert all file and path names from the command line to absolute paths. This helps when running tegra-uboot-flasher out-of-tree with a local bootloader or flash image. This is needed, since tegra-uboot-flasher cd's to a temporary work directory when executing most commands, which causes relative path names to no longer be valid. Signed-off-by: Stephen Warren --- tegra-uboot-flasher | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/tegra-uboot-flasher b/tegra-uboot-flasher index 5f68d40..8c6a21c 100755 --- a/tegra-uboot-flasher +++ b/tegra-uboot-flasher @@ -182,7 +182,6 @@ def func_flash(): gen_flashcmd = gen_flashcmds[flash_type] if args.work_dir: - workdir = os.path.abspath(args.work_dir) mkdir(workdir) else: workdir = tempfile.mkdtemp() @@ -326,14 +325,24 @@ if args.debug: print args scripts_dir = os.path.dirname(os.path.abspath(__file__)) scripts_parent_dir = os.path.dirname(scripts_dir) +path_args = ( + 'bootloader', + 'data_dir', + 'flash_image', + 'work_dir', +) +for path_arg in path_args: + if args.__dict__.has_key(path_arg) and args.__dict__[path_arg]: + args.__dict__[path_arg] = os.path.abspath(args.__dict__[path_arg]) + if not args.force_no_out_dir: - out_tools_dir = os.path.abspath(os.path.join(scripts_parent_dir, '_out_tools')) + out_tools_dir = os.path.join(scripts_parent_dir, '_out_tools') if os.path.exists(out_tools_dir): if args.debug: print 'Detected build tree; adding ' + out_tools_dir + ' to $PATH' os.environ['PATH'] = out_tools_dir + ':' + os.environ['PATH'] if not args.data_dir and not args.force_no_out_dir: - out_data_dir = os.path.abspath(os.path.join(scripts_parent_dir, '_out')) + out_data_dir = os.path.join(scripts_parent_dir, '_out') if os.path.exists(out_data_dir): if args.debug: print 'Detected build tree; using ' + out_data_dir + ' as data dir' args.data_dir = out_data_dir -- cgit v1.2.1