diff options
author | SG <who.just.the.doctor@gmail.com> | 2021-07-25 14:55:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-25 14:55:23 +0300 |
commit | 81080a3a8b9cb7caa05bee941f4015dcfcca5ced (patch) | |
tree | 1a4a9297304b03712bf8bcd92d6f6b777307ea53 /applications/storage | |
parent | fb305eddb27cb29f1cd24df248d22778a0863e00 (diff) |
[FL-1191] Storage: CLI mkdir command #603
Co-authored-by: あく <alleteam@gmail.com>
Diffstat (limited to 'applications/storage')
-rw-r--r-- | applications/storage/storage-cli.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/applications/storage/storage-cli.c b/applications/storage/storage-cli.c index 203daa8a..684e9a8b 100644 --- a/applications/storage/storage-cli.c +++ b/applications/storage/storage-cli.c @@ -30,6 +30,7 @@ void storage_cli_print_usage() { "\twrite\t - read data from cli and append it to file, <args> should contain how many bytes you want to write\r\n"); printf("\tcopy\t - copy file to new file, <args> must contain new path\r\n"); printf("\trename\t - move file to new file, <args> must contain new path\r\n"); + printf("\tmkdir\t - creates a new directory\r\n"); }; void storage_cli_print_error(FS_Error error) { @@ -285,6 +286,17 @@ void storage_cli_rename(Cli* cli, string_t old_path, string_t args) { furi_record_close("storage"); } +void storage_cli_mkdir(Cli* cli, string_t path) { + Storage* api = furi_record_open("storage"); + FS_Error error = storage_common_mkdir(api, string_get_cstr(path)); + + if(error != FSE_OK) { + storage_cli_print_error(error); + } + + furi_record_close("storage"); +} + void storage_cli(Cli* cli, string_t args, void* context) { string_t cmd; string_t path; @@ -342,6 +354,11 @@ void storage_cli(Cli* cli, string_t args, void* context) { break; } + if(string_cmp_str(cmd, "mkdir") == 0) { + storage_cli_mkdir(cli, path); + break; + } + storage_cli_print_usage(); } while(false); |