1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

Target: Added directory_exists method

This commit is contained in:
Sebastian Goscik 2016-02-15 15:07:19 +00:00
parent 1890db7c04
commit 33603c6648

View File

@ -348,6 +348,12 @@ class Target(object):
command = 'if [ -e \'{}\' ]; then echo 1; else echo 0; fi' command = 'if [ -e \'{}\' ]; then echo 1; else echo 0; fi'
return boolean(self.execute(command.format(filepath)).strip()) 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): def list_file_systems(self):
output = self.execute('mount') output = self.execute('mount')
fstab = [] fstab = []