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

target: Add Target.makedirs()

Create a directory on the target.
This commit is contained in:
douglas-raillard-arm 2020-06-18 11:23:00 +01:00 committed by Marc Bonnici
parent bef1ec3afc
commit 590069f01f
2 changed files with 7 additions and 0 deletions

View File

@ -585,6 +585,9 @@ class Target(object):
# files # files
def makedirs(self, path):
self.execute('mkdir -p {}'.format(quote(folder)))
def file_exists(self, filepath): def file_exists(self, filepath):
command = 'if [ -e {} ]; then echo 1; else echo 0; fi' command = 'if [ -e {} ]; then echo 1; else echo 0; fi'
output = self.execute(command.format(quote(filepath)), as_root=self.is_rooted) output = self.execute(command.format(quote(filepath)), as_root=self.is_rooted)

View File

@ -436,6 +436,10 @@ Target
Return a list of :class:`PsEntry` instances for all running processes on the Return a list of :class:`PsEntry` instances for all running processes on the
system. system.
.. method:: Target.makedirs(self, path)
Create a directory at the given path and all its ancestors if needed.
.. method:: Target.file_exists(self, filepath) .. method:: Target.file_exists(self, filepath)
Returns ``True`` if the specified path exists on the target and ``False`` Returns ``True`` if the specified path exists on the target and ``False``