|
@@ -1,3 +1,14 @@
|
|
|
|
+#include <string.h> // strcpy, strlen
|
|
|
|
+
|
|
|
|
+#ifdef __unix__
|
|
|
|
+#include <dirent.h>
|
|
|
|
+#include <unistd.h>
|
|
|
|
+#endif
|
|
|
|
+
|
|
|
|
+#ifndef _WIN32
|
|
|
|
+# include <pwd.h>
|
|
|
|
+#endif
|
|
|
|
+
|
|
struct icons {
|
|
struct icons {
|
|
struct nk_image desktop;
|
|
struct nk_image desktop;
|
|
struct nk_image home;
|
|
struct nk_image home;
|
|
@@ -78,17 +89,6 @@ struct file_browser {
|
|
struct media *media;
|
|
struct media *media;
|
|
};
|
|
};
|
|
|
|
|
|
-#ifdef __unix__
|
|
|
|
-#include <dirent.h>
|
|
|
|
-#include <unistd.h>
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-#ifndef _WIN32
|
|
|
|
-# include <pwd.h>
|
|
|
|
-#endif
|
|
|
|
-
|
|
|
|
-#include <string.h>
|
|
|
|
-
|
|
|
|
static void
|
|
static void
|
|
die(const char *fmt, ...)
|
|
die(const char *fmt, ...)
|
|
{
|
|
{
|
|
@@ -456,7 +456,7 @@ file_browser_run(struct file_browser *browser, struct nk_context *ctx)
|
|
/* draw and execute directory buttons */
|
|
/* draw and execute directory buttons */
|
|
if (nk_button_image(ctx,media->icons.directory))
|
|
if (nk_button_image(ctx,media->icons.directory))
|
|
index = (int)j;
|
|
index = (int)j;
|
|
-
|
|
|
|
|
|
+
|
|
qsort(browser->directories, browser->dir_count, sizeof(char *), cmp_fn);
|
|
qsort(browser->directories, browser->dir_count, sizeof(char *), cmp_fn);
|
|
nk_label(ctx, browser->directories[j], NK_TEXT_LEFT);
|
|
nk_label(ctx, browser->directories[j], NK_TEXT_LEFT);
|
|
} else {
|
|
} else {
|
|
@@ -501,7 +501,7 @@ file_browser_run(struct file_browser *browser, struct nk_context *ctx)
|
|
{
|
|
{
|
|
fprintf(stdout, "File dialog has been closed!\n");
|
|
fprintf(stdout, "File dialog has been closed!\n");
|
|
file_browser_is_open = nk_false;
|
|
file_browser_is_open = nk_false;
|
|
- }
|
|
|
|
|
|
+ }
|
|
if(nk_button_label(ctx, "Open"))
|
|
if(nk_button_label(ctx, "Open"))
|
|
fprintf(stdout, "Insert routine to open/save the file!\n");
|
|
fprintf(stdout, "Insert routine to open/save the file!\n");
|
|
}
|
|
}
|