@@ -287,6 +287,9 @@ def __call__(self, string):
287
287
parser_read_all_files .add_argument (
288
288
"--by-file-id" , action = "store_true" ,
289
289
help = "Read unknown filenames by its id" )
290
+ parser_read_all_files .add_argument (
291
+ "--all-by-file-id" , action = "store_true" ,
292
+ help = "Read all filenames by its id" )
290
293
291
294
parser_write_all_files = subparsers .add_parser (
292
295
"write_all_files" ,
@@ -1281,7 +1284,7 @@ def list_filesystem(self, json_output=False, inactive=False, extended=False):
1281
1284
if json_output :
1282
1285
fat_info .print_sffs_info_json ()
1283
1286
1284
- def read_all_files (self , local_dir , by_file_id = False ):
1287
+ def read_all_files (self , local_dir , by_file_id = False , all_by_file_id = False ):
1285
1288
fat_info = self .get_fat_info (inactive = False )
1286
1289
fat_info .print_sffs_info ()
1287
1290
for f in fat_info .files :
@@ -1291,12 +1294,16 @@ def read_all_files(self, local_dir, by_file_id=False):
1291
1294
1292
1295
if ccname .startswith ('/' ):
1293
1296
ccname = ccname [1 :]
1297
+
1294
1298
target_file = os .path .join (local_dir , ccname )
1299
+ if all_by_file_id :
1300
+ target_file = os .path .join (local_dir , str (f .index ))
1301
+
1295
1302
if not os .path .exists (os .path .dirname (target_file )):
1296
1303
os .makedirs (name = os .path .dirname (target_file ))
1297
1304
1298
1305
try :
1299
- if by_file_id and f .fname == '' :
1306
+ if all_by_file_id or ( by_file_id and f .fname == '' ) :
1300
1307
self .read_file (ccname , open (target_file , 'wb' , - 1 ), f .index )
1301
1308
else :
1302
1309
self .read_file (f .fname , open (target_file , 'wb' , - 1 ))
@@ -1423,7 +1430,7 @@ def main():
1423
1430
cc .list_filesystem (command .json_output , command .inactive , command .extended )
1424
1431
1425
1432
if command .cmd == "read_all_files" :
1426
- cc .read_all_files (command .local_dir , command .by_file_id )
1433
+ cc .read_all_files (command .local_dir , command .by_file_id , command . all_by_file_id )
1427
1434
1428
1435
if command .cmd == "write_all_files" :
1429
1436
use_api = True
0 commit comments