mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +00:00
refactor: add pathbuf and std::string-friendly helpers to tr_sys file and path funcs (#3118)
* refactor: add sv-friendly tr_sys_dir_create() variant * refactor: add sv-friendly tr_sys_path_get_info() variant * refactor: add sv-friendly tr_sys_path_exists() variant * refactor: add sv-friendly tr_sys_path_remove() variant * refactor: add sv-friendly tr_sys_path_rename() variant * fixup! refactor: add sv-friendly tr_sys_path_rename() variant
This commit is contained in:
@@ -242,14 +242,13 @@ int tr_main(int argc, char* argv[])
|
||||
|
||||
if (auto sv = std::string_view{}; tr_variantDictFindStrView(&settings, TR_KEY_download_dir, &sv))
|
||||
{
|
||||
// tr_sys_path_exists and tr_sys_dir_create need zero-terminated strs
|
||||
auto const sz_download_dir = std::string{ sv };
|
||||
|
||||
if (!tr_sys_path_exists(sz_download_dir.c_str()))
|
||||
if (!tr_sys_path_exists(sz_download_dir))
|
||||
{
|
||||
tr_error* error = nullptr;
|
||||
|
||||
if (!tr_sys_dir_create(sz_download_dir.c_str(), TR_SYS_DIR_CREATE_PARENTS, 0700, &error))
|
||||
if (!tr_sys_dir_create(sz_download_dir, TR_SYS_DIR_CREATE_PARENTS, 0700, &error))
|
||||
{
|
||||
fprintf(stderr, "Unable to create download directory \"%s\": %s\n", sz_download_dir.c_str(), error->message);
|
||||
tr_error_free(error);
|
||||
|
||||
Reference in New Issue
Block a user