enum playlist_result spl_rename(const char *utf8from, const char *utf8to) { char *from_path_fs, *to_path_fs; static enum playlist_result ret; if (!spl_valid_name(utf8from) || !spl_valid_name(utf8to)) return PLAYLIST_RESULT_BAD_NAME; from_path_fs = map_spl_utf8_to_fs(utf8from); to_path_fs = map_spl_utf8_to_fs(utf8to); if (from_path_fs != NULL && to_path_fs != NULL) ret = spl_rename_internal(from_path_fs, to_path_fs); else ret = PLAYLIST_RESULT_DISABLED; g_free(from_path_fs); g_free(to_path_fs); return ret; }
bool spl_rename(const char *utf8from, const char *utf8to, GError **error_r) { if (spl_map(error_r) == NULL) return false; char *from_path_fs = spl_map_to_fs(utf8from, error_r); if (from_path_fs == NULL) return false; char *to_path_fs = spl_map_to_fs(utf8to, error_r); if (to_path_fs == NULL) { g_free(from_path_fs); return false; } bool success = spl_rename_internal(from_path_fs, to_path_fs, error_r); g_free(from_path_fs); g_free(to_path_fs); return success; }