summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c6
-rw-r--r--src/ui.c12
2 files changed, 11 insertions, 7 deletions
diff --git a/src/main.c b/src/main.c
index 3410f37..1971add 100644
--- a/src/main.c
+++ b/src/main.c
@@ -7,6 +7,7 @@
#include <stdlib.h>
#include "toml.h"
+#include "nfd.h"
#define MAX_VERTEX_BUFFER 512 * 1024
#define MAX_ELEMENT_BUFFER 128 * 1024
#define NK_INCLUDE_FIXED_TYPES
@@ -111,6 +112,10 @@ int main(void) {
exit(EXIT_FAILURE);
}
+ /* NFD */
+ if (NFD_Init() != NFD_OKAY)
+ exit(EXIT_FAILURE);
+
/* Logger setup */
struct logger *logger = setup_logger();
// Put it in ui_struct
@@ -189,6 +194,7 @@ int main(void) {
}
curl_cleanup(&stat);
nk_glfw3_shutdown(&glfw);
+ NFD_Quit();
glfwTerminate();
exit(0);
}
diff --git a/src/ui.c b/src/ui.c
index 3065113..8065237 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -6,7 +6,7 @@
#include "nuklear.h"
#include "process_url.h"
-#include "tinyfiledialogs.h"
+#include "nfd.h"
#include "constants.h"
#include "logger.h"
@@ -16,7 +16,7 @@
static nk_size pct;
static bool show_app_about;
-static char *outPath;
+static nfdchar_t *outPath;
void load_ui(struct ui_struct *ui) {
static char text[USHRT_MAX], box_buffer[UINT16_MAX], status_string[UCHAR_MAX];
@@ -103,12 +103,10 @@ void load_ui(struct ui_struct *ui) {
// Clear logger text
clear_log();
- outPath = tinyfd_selectFolderDialog("Pick a download folder: ", NULL);
-
- if (outPath) {
- DEBUG_PRINT("tinyfd gets outPath: %s\n", outPath);
+ if (NFD_PickFolder(&outPath, NULL) == NFD_OKAY && outPath) {
+ DEBUG_PRINT("nfd gets outPath: %s\n", (char *)outPath);
append_log("Got URL: %s\n", text);
- add_url(text, outPath, NULL, NULL, NULL);
+ add_url(text, (char *)outPath, NULL, NULL, NULL);
} else {
LOG("NFD", "Please specify a valid file PATH to write to!\n");
}