From 33603c6648e4965fae34a78efede5b53eff3c13f Mon Sep 17 00:00:00 2001 From: Sebastian Goscik Date: Mon, 15 Feb 2016 15:07:19 +0000 Subject: [PATCH] Target: Added directory_exists method --- devlib/target.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/devlib/target.py b/devlib/target.py index 5303f3a..1fb2114 100644 --- a/devlib/target.py +++ b/devlib/target.py @@ -348,6 +348,12 @@ class Target(object): command = 'if [ -e \'{}\' ]; then echo 1; else echo 0; fi' return boolean(self.execute(command.format(filepath)).strip()) + def directory_exists(self, filepath): + output = self.execute('if [ -d \'{}\' ]; then echo 1; else echo 0; fi'.format(filepath)) + # output from ssh my contain part of the expression in the buffer, + # split out everything except the last word. + return boolean(output.split()[-1]) # pylint: disable=maybe-no-member + def list_file_systems(self): output = self.execute('mount') fstab = []