1
0
mirror of https://github.com/ARM-software/devlib.git synced 2024-10-06 02:40:50 +01:00

AndroidTarget: Ensure path is correctly quoted when listing directories

Previously the path for listing a directory on the device was not quoted
causing it to fail on paths containing spaces. Now ensure the string is
quoted and any quotes contained in the string as escaped.
This commit is contained in:
Marc Bonnici 2018-05-10 11:07:02 +01:00 committed by setrofim
parent 63bf68b49d
commit 329df6f42e

View File

@ -1099,7 +1099,7 @@ class AndroidTarget(Target):
def list_directory(self, path, as_root=False):
if self.ls_command == '':
self.__setup_list_directory()
contents = self.execute('{} {}'.format(self.ls_command, path), as_root=as_root)
contents = self.execute('{} "{}"'.format(self.ls_command, escape_double_quotes(path)), as_root=as_root)
return [x.strip() for x in contents.split('\n') if x.strip()]
def install(self, filepath, timeout=None, with_name=None): # pylint: disable=W0221