 b9a766d909
			
		
	
	
		b9a766d909
		
	
	
	
	
		
			
			* Added support for running applications from SD card (FAPs - Flipper Application Packages) * Added plugin_dist target for fbt to build FAPs * All apps of type FlipperAppType.EXTERNAL and FlipperAppType.PLUGIN are built as FAPs by default * Updated VSCode configuration for new fbt features - re-deploy stock configuration to use them * Added debugging support for FAPs with fbt debug & VSCode * Added public firmware API with automated versioning Co-authored-by: hedger <hedger@users.noreply.github.com> Co-authored-by: SG <who.just.the.doctor@gmail.com> Co-authored-by: あく <alleteam@gmail.com>
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.8 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| #include "lfs_backup.h"
 | |
| 
 | |
| #include <toolbox/tar/tar_archive.h>
 | |
| 
 | |
| #include <bt/bt_settings_filename.h>
 | |
| #include <bt/bt_service/bt_keys_filename.h>
 | |
| #include <dolphin/helpers/dolphin_state_filename.h>
 | |
| #include <desktop/helpers/slideshow_filename.h>
 | |
| #include <desktop/desktop_settings_filename.h>
 | |
| #include <notification/notification_settings_filename.h>
 | |
| 
 | |
| #define LFS_BACKUP_DEFAULT_LOCATION EXT_PATH(LFS_BACKUP_DEFAULT_FILENAME)
 | |
| 
 | |
| static void backup_name_converter(string_t filename) {
 | |
|     if(string_empty_p(filename) || (string_get_char(filename, 0) == '.')) {
 | |
|         return;
 | |
|     }
 | |
| 
 | |
|     /* Filenames are already prefixed with '.' */
 | |
|     const char* const names[] = {
 | |
|         BT_SETTINGS_FILE_NAME,
 | |
|         BT_KEYS_STORAGE_FILE_NAME,
 | |
|         DESKTOP_SETTINGS_FILE_NAME,
 | |
|         NOTIFICATION_SETTINGS_FILE_NAME,
 | |
|         SLIDESHOW_FILE_NAME,
 | |
|         DOLPHIN_STATE_FILE_NAME,
 | |
|     };
 | |
| 
 | |
|     for(size_t i = 0; i < COUNT_OF(names); i++) {
 | |
|         if(string_equal_str_p(filename, &names[i][1])) {
 | |
|             string_set_str(filename, names[i]);
 | |
|             return;
 | |
|         }
 | |
|     }
 | |
| }
 | |
| 
 | |
| bool lfs_backup_create(Storage* storage, const char* destination) {
 | |
|     const char* final_destination =
 | |
|         destination && strlen(destination) ? destination : LFS_BACKUP_DEFAULT_LOCATION;
 | |
|     return storage_int_backup(storage, final_destination) == FSE_OK;
 | |
| }
 | |
| 
 | |
| bool lfs_backup_exists(Storage* storage, const char* source) {
 | |
|     const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION;
 | |
|     FileInfo fi;
 | |
|     return storage_common_stat(storage, final_source, &fi) == FSE_OK;
 | |
| }
 | |
| 
 | |
| bool lfs_backup_unpack(Storage* storage, const char* source) {
 | |
|     const char* final_source = source && strlen(source) ? source : LFS_BACKUP_DEFAULT_LOCATION;
 | |
|     return storage_int_restore(storage, final_source, backup_name_converter) == FSE_OK;
 | |
| }
 |