M*LIB: non-inlined strings, FuriString primitive (#1795)
* Quicksave 1 * Header stage complete * Source stage complete * Lint & merge fixes * Includes * Documentation step 1 * FBT: output free size considering BT STACK * Documentation step 2 * py lint * Fix music player plugin * unit test stage 1: string allocator, mem, getters, setters, appends, compare, search. * unit test: string equality * unit test: string replace * unit test: string start_with, end_with * unit test: string trim * unit test: utf-8 * Rename * Revert fw_size changes * Simplify CLI backspace handling * Simplify CLI character insert * Merge fixes * Furi: correct filenaming and spelling * Bt: remove furi string include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -173,17 +173,20 @@ static bool file_stream_delete_and_insert(
|
||||
Stream* scratch_stream = file_stream_alloc(_stream->storage);
|
||||
|
||||
// TODO: we need something like "storage_open_tmpfile and storage_close_tmpfile"
|
||||
string_t scratch_name;
|
||||
string_t tmp_name;
|
||||
string_init(tmp_name);
|
||||
FuriString* scratch_name;
|
||||
FuriString* tmp_name;
|
||||
tmp_name = furi_string_alloc();
|
||||
storage_get_next_filename(
|
||||
_stream->storage, STORAGE_ANY_PATH_PREFIX, ".scratch", ".pad", tmp_name, 255);
|
||||
string_init_printf(scratch_name, ANY_PATH("%s.pad"), string_get_cstr(tmp_name));
|
||||
string_clear(tmp_name);
|
||||
scratch_name = furi_string_alloc_printf(ANY_PATH("%s.pad"), furi_string_get_cstr(tmp_name));
|
||||
furi_string_free(tmp_name);
|
||||
|
||||
do {
|
||||
if(!file_stream_open(
|
||||
scratch_stream, string_get_cstr(scratch_name), FSAM_READ_WRITE, FSOM_CREATE_NEW))
|
||||
scratch_stream,
|
||||
furi_string_get_cstr(scratch_name),
|
||||
FSAM_READ_WRITE,
|
||||
FSOM_CREATE_NEW))
|
||||
break;
|
||||
|
||||
size_t current_position = stream_tell(stream);
|
||||
@@ -225,8 +228,8 @@ static bool file_stream_delete_and_insert(
|
||||
} while(false);
|
||||
|
||||
stream_free(scratch_stream);
|
||||
storage_common_remove(_stream->storage, string_get_cstr(scratch_name));
|
||||
string_clear(scratch_name);
|
||||
storage_common_remove(_stream->storage, furi_string_get_cstr(scratch_name));
|
||||
furi_string_free(scratch_name);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
Reference in New Issue
Block a user