Allow importing from a single app .json.
This commit is contained in:
		@@ -231,6 +231,12 @@ static void _tf_ssb_import_app_json(tf_ssb_t* ssb, uv_loop_t* loop, JSContext* c
 | 
			
		||||
 | 
			
		||||
void tf_ssb_import(tf_ssb_t* ssb, const char* user, const char* path)
 | 
			
		||||
{
 | 
			
		||||
	if (strlen(path) > strlen(".json") && strcasecmp(path + strlen(path) - strlen(".json"), ".json") == 0)
 | 
			
		||||
	{
 | 
			
		||||
		_tf_ssb_import_app_json(ssb, tf_ssb_get_loop(ssb), tf_ssb_get_context(ssb), user, path);
 | 
			
		||||
	}
 | 
			
		||||
	else
 | 
			
		||||
	{
 | 
			
		||||
		uv_fs_t req = { 0 };
 | 
			
		||||
		int r = uv_fs_scandir(tf_ssb_get_loop(ssb), &req, path, 0, NULL);
 | 
			
		||||
		if (r >= 0)
 | 
			
		||||
@@ -253,6 +259,7 @@ void tf_ssb_import(tf_ssb_t* ssb, const char* user, const char* path)
 | 
			
		||||
			tf_printf("Failed to scan directory %s: %s.", path, uv_strerror(r));
 | 
			
		||||
		}
 | 
			
		||||
		uv_fs_req_cleanup(&req);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static char* _tf_ssb_import_read_current_file_from_zip(unzFile zip, size_t* size)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user