diff options
author | Stephen Warren <swarren@nvidia.com> | 2014-01-20 15:22:14 -0700 |
---|---|---|
committer | Stephen Warren <swarren@nvidia.com> | 2014-01-20 15:25:10 -0700 |
commit | df6545ee4e3b40d38440b2e9316b5be4c0b4f6e2 (patch) | |
tree | 6417eac6d45d0ac40f5abd76e175a07b4a52528d | |
parent | 69cec09fe3e78a682bdf6d0736bda59c1b3e587f (diff) | |
download | tegra-uboot-flasher-scripts-df6545ee4e3b40d38440b2e9316b5be4c0b4f6e2.tar.gz |
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 <swarren@nvidia.com>
-rwxr-xr-x | tegra-uboot-flasher | 15 |
1 files 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 |