mirror of
https://github.com/google/adb-sync.git
synced 2026-01-03 09:58:01 +00:00
Merge pull request #3 from qezt/qezt
now it will be compatible with N's ls output format
This commit is contained in:
13
adb-sync
13
adb-sync
@@ -79,13 +79,18 @@ class AdbFileSystem(object):
|
|||||||
[-r][-w][-xsS]
|
[-r][-w][-xsS]
|
||||||
[-r][-w][-xsS]
|
[-r][-w][-xsS]
|
||||||
[-r][-w][-xtT] # Mode string.
|
[-r][-w][-xtT] # Mode string.
|
||||||
[ ]
|
[ ]+
|
||||||
|
(?:
|
||||||
|
[0-9]+ # number of hard links
|
||||||
|
[ ]+
|
||||||
|
)?
|
||||||
[^ ]+ # User name/ID.
|
[^ ]+ # User name/ID.
|
||||||
[ ]+
|
[ ]+
|
||||||
[^ ]+ # Group name/ID.
|
[^ ]+ # Group name/ID.
|
||||||
[ ]+
|
[ ]+
|
||||||
(?(S_IFBLK) [^ ]+[ ]+[^ ]+[ ]+) # Device numbers.
|
(?(S_IFBLK) [^ ]+[ ]+[^ ]+[ ]+) # Device numbers.
|
||||||
(?(S_IFCHR) [^ ]+[ ]+[^ ]+[ ]+) # Device numbers.
|
(?(S_IFCHR) [^ ]+[ ]+[^ ]+[ ]+) # Device numbers.
|
||||||
|
(?(S_IFDIR) [0-9]+ [ ]+)? # directory Size.
|
||||||
(?(S_IFREG)
|
(?(S_IFREG)
|
||||||
(?P<st_size> [0-9]+) # Size.
|
(?P<st_size> [0-9]+) # Size.
|
||||||
[ ]+)
|
[ ]+)
|
||||||
@@ -221,6 +226,8 @@ class AdbFileSystem(object):
|
|||||||
with self.Stdout(self.adb + [b'shell', _sprintf(b'ls -al %s',
|
with self.Stdout(self.adb + [b'shell', _sprintf(b'ls -al %s',
|
||||||
self.QuoteArgument(path + b'/'))]) as stdout:
|
self.QuoteArgument(path + b'/'))]) as stdout:
|
||||||
for line in stdout:
|
for line in stdout:
|
||||||
|
if line.startswith('total '):
|
||||||
|
continue
|
||||||
line = line.rstrip(b'\r\n')
|
line = line.rstrip(b'\r\n')
|
||||||
try:
|
try:
|
||||||
statdata, filename = self.LsToStat(line)
|
statdata, filename = self.LsToStat(line)
|
||||||
@@ -238,6 +245,8 @@ class AdbFileSystem(object):
|
|||||||
with self.Stdout(self.adb + [b'shell', _sprintf(b'ls -ald %s',
|
with self.Stdout(self.adb + [b'shell', _sprintf(b'ls -ald %s',
|
||||||
self.QuoteArgument(path))]) as stdout:
|
self.QuoteArgument(path))]) as stdout:
|
||||||
for line in stdout:
|
for line in stdout:
|
||||||
|
if line.startswith('total '):
|
||||||
|
continue
|
||||||
line = line.rstrip(b'\r\n')
|
line = line.rstrip(b'\r\n')
|
||||||
statdata, filename = self.LsToStat(line)
|
statdata, filename = self.LsToStat(line)
|
||||||
self.stat_cache[path] = statdata
|
self.stat_cache[path] = statdata
|
||||||
@@ -322,6 +331,8 @@ def BuildFileList(fs, path, prefix=b''):
|
|||||||
_print(b'Warning: could not cache lstat for %s', path)
|
_print(b'Warning: could not cache lstat for %s', path)
|
||||||
files.sort()
|
files.sort()
|
||||||
for n in files:
|
for n in files:
|
||||||
|
if n == '.' or n == '..':
|
||||||
|
continue
|
||||||
for t in BuildFileList(fs, path + b'/' + n, prefix + b'/' + n):
|
for t in BuildFileList(fs, path + b'/' + n, prefix + b'/' + n):
|
||||||
yield t
|
yield t
|
||||||
elif stat.S_ISREG(statresult.st_mode):
|
elif stat.S_ISREG(statresult.st_mode):
|
||||||
|
|||||||
Reference in New Issue
Block a user