summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMole Shang <[email protected]>2023-08-06 12:54:47 +0800
committerMole Shang <[email protected]>2023-08-06 13:13:47 +0800
commit6fc145906eafdbd89f4558b79282a9e5d722afbc (patch)
tree5eb33ff84acbc62d9e7e82b0a1277595ecf377c0 /src
parent2f70538a4fe5427de44697d5585351216426a31b (diff)
downloadhinata-6fc145906eafdbd89f4558b79282a9e5d722afbc.tar.gz
hinata-6fc145906eafdbd89f4558b79282a9e5d722afbc.tar.bz2
hinata-6fc145906eafdbd89f4558b79282a9e5d722afbc.zip
xmake: migrate from NFD to tinyfiledialogs
nativefiledialog-extended works great on Linux w/ portal support, but somehow is too complex to build on Windows. [1] Switch to tinyfd for simplicity. [1]: Visual Studio CL.exe would fail with MSB6001. ``` Error MSB6001: Invalid command line switch for "CL.exe". Item has already been added. Key in dictionary: 'VCInstallDir' Key being added: 'VCINSTALLDIR' ``` For further information, see below: https://social.msdn.microsoft.com/Forums/vstudio/en-US/5de6d7e3-7a38-4712-ba59-be179808bf9e/error-msb6001-invalid-command-line-switch-for-clexe https://github.com/dotnet/msbuild/issues/5726 It's been over 10 years, and Microsoft still claims that case sensitivity thing is a FEATURE. Holy M$, Thank you.
Diffstat (limited to 'src')
-rw-r--r--src/main.c7
-rw-r--r--src/ui.c12
2 files changed, 5 insertions, 14 deletions
diff --git a/src/main.c b/src/main.c
index d60112e..4306b87 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,6 @@
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <curl/curl.h>
-#include <nfd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -21,12 +20,12 @@
#include "nuklear_glfw_gl3.h"
#include "constants.h"
-#include "unifont.h"
#include "logger.h"
#include "main.h"
#include "process_url.h"
#include "style.h"
#include "ui.h"
+#include "unifont.h"
extern int win_width, win_height;
extern void load_ui(struct ui_struct *);
@@ -77,9 +76,6 @@ int main(void) {
exit(EXIT_FAILURE);
}
- /* Native File Dialog */
- NFD_Init();
-
/* Logger setup */
struct logger *logger = setup_logger();
// Put it in ui_struct
@@ -155,7 +151,6 @@ int main(void) {
MAX_ELEMENT_BUFFER);
glfwSwapBuffers(win);
}
- NFD_Quit();
curl_cleanup(&stat);
nk_glfw3_shutdown(&glfw);
glfwTerminate();
diff --git a/src/ui.c b/src/ui.c
index 7f1dc52..da6fd1b 100644
--- a/src/ui.c
+++ b/src/ui.c
@@ -5,7 +5,7 @@
#include <string.h>
#include "nuklear.h"
-#include <nfd.h>
+#include "tinyfiledialogs.h"
#include "constants.h"
#include "logger.h"
@@ -13,7 +13,7 @@
#include "ui.h"
static nk_size pct;
-static nfdchar_t *outPath;
+static char *outPath;
void load_ui(struct ui_struct *ui) {
static char text[USHRT_MAX], box_buffer[UINT16_MAX], status_string[UCHAR_MAX];
@@ -52,14 +52,10 @@ void load_ui(struct ui_struct *ui) {
// Clear logger text
clear_log();
- nfdresult_t result = NFD_PickFolder(&outPath, "");
- if (result == NFD_OKAY) {
- DEBUG_PRINT("[NFD] outPath: %s\n", outPath);
- } else if (result == NFD_ERROR) {
- LOG("NFD", "Error: %s\n", NFD_GetError());
- }
+ outPath = tinyfd_selectFolderDialog("Pick a download folder: ", NULL);
if (outPath) {
+ DEBUG_PRINT("tinyfd gets outPath: %s\n", outPath);
append_log("Got URL: %s\n", text);
add_url(text, outPath, NULL, NULL);
} else {