By using natural instead of alphabetical sorting, we support sorting by
vercodes properly and thus app versions show in the correct order.
return count
+def natural_key(s):
+ return [int(sp) if sp.isdigit() else sp for sp in re.split(r'(\d+)', s)]
+
+
class KnownApks:
def __init__(self):
lst.append(line)
with open(self.path, 'w') as f:
- for line in sorted(lst):
+ for line in sorted(lst, key=natural_key):
f.write(line + '\n')
# Record an apk (if it's new, otherwise does nothing)