sole / aafm

Android ADB file manager
GNU General Public License v3.0
222 stars 50 forks source link

aafm and Nougat (Cyanogenmod) #70

Open dlord2 opened 7 years ago

dlord2 commented 7 years ago

Hello,

to get aafm up and running on Nougat (Android 7.1 on Cyanogenmod) you need to change line 107 of src/Aafm.py to the following

before: pattern = re.compile(r"^(?P<permissions>[dl\-][rwx\-]+) (?P<owner>\w+)\W+(?P<group>[\w_]+)\W*(?P<size>\d+)?\W+(?P<datetime>\d{4}-\d{2}-\d{2} \d{2}:\d{2}) (?P<name>.+)$")

after: pattern = re.compile(r"^(?P<permissions>[dl\-][rwx\-]+)\s+(?P<hardlinks>\d+)\s+(?P<owner>\w+)\W+(?P<group>[\w_]+)\W*(?P<size>\d+)?\W+(?P<datetime>\d{4}-\d{2}-\d{2} \d{2}:\d{2}) (?P<name>.+)$")

and to get the thing with copying files right, a modification of the section around line 180 is neccessary.

if entry['is_directory']:
    if not filename.startswith('.'):                                  # Added!
        entry_full_path = os.path.join(dirpath, filename)             # indent changed
        queue.append(entry_full_path)                                 # indent changed
        dirnames.append(filename)                                     # indent changed

Around line 90 the code needs to look like the following to get the disksize right.

splitted = lines[1].split()
if len(splitted) != 6:                                                   # was 5 before
     return '-'

mountpoint, size, used, free, blksize, dfpath = splitted  # df path was missing before

for some tweeking of the debug output (avoiding to get annoyed with that total...bogus output add a line before the print output in line 147. Afterwards it looks like the following.

if not line.startswith('total '):                                            # Added!
     print line, "wasn't matched, please report to the developer!"   # Indent changed

hmm, by the time a diff would be more usefull ;-)

Best regards

Daniel

mdminhazulhaque commented 7 years ago

Same issue happened for me. Using LineageOS 14.1. I used the following solution.

def device_list_files_parsed(self, device_dir):
        command = ['ls', '-l', '-a', device_dir]
        entries = {}
        reader = csv.DictReader(self.adb_shell(*command),
                delimiter=' ',
                skipinitialspace=True,
                fieldnames=['permissions', 'links', 'owner', 'group', 'size', 'date', 'time', 'name']
                )
        for line in reader:
                filename = line['name']
                is_directory = line['permissions'].startswith('d')
                entries[filename] = { 
                        'is_directory': ,
                        'size': 0 if fsize is None else line['size'],
                        'timestamp': 0.0, # TODO
                        'permissions': line['permissions'],
                        'owner': line['owner'],
                        'group': line['group']
                }
        return entries