annotate paths.c @ 1996:e35b00626b3e

Update cycle to VGM sample conversion based on ValleyBell's suggestion
author Michael Pavone <pavone@retrodev.com>
date Thu, 18 Jun 2020 00:28:53 -0700
parents dda7479f3bbb
children bc68560b4a04
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #include <string.h>
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #include <stdlib.h>
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3 #include "blastem.h"
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #include "util.h"
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 static char **current_path;
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
7
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
8 static void persist_path(void)
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
9 {
1673
ab3b465c052c Fix Windows implentation of get_config_dir() so config file gets saved to the right place. Fix location for sticky_path file on all platforms
Michael Pavone <pavone@retrodev.com>
parents: 1524
diff changeset
10 char *pathfname = alloc_concat(get_userdata_dir(), PATH_SEP "blastem" PATH_SEP "sticky_path");
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
11 FILE *f = fopen(pathfname, "wb");
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 if (f) {
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13 if (fwrite(*current_path, 1, strlen(*current_path), f) != strlen(*current_path)) {
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 warning("Failed to save menu path");
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
15 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16 fclose(f);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 } else {
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 warning("Failed to save menu path: Could not open %s for writing\n", pathfname);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 free(pathfname);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
23
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
24 #ifdef __ANDROID__
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 #include <SDL.h>
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26 #include <jni.h>
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
27 static char *get_external_storage_path()
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 {
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
29 static char *ret;
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 if (ret) {
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
31 return ret;
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
32 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33 JNIEnv *env = SDL_AndroidGetJNIEnv();
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34 if ((*env)->PushLocalFrame(env, 8) < 0) {
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
35 return NULL;
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
38 jclass Environment = (*env)->FindClass(env, "android/os/Environment");
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
39 jmethodID getExternalStorageDirectory =
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
40 (*env)->GetStaticMethodID(env, Environment, "getExternalStorageDirectory", "()Ljava/io/File;");
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
41 jobject file = (*env)->CallStaticObjectMethod(env, Environment, getExternalStorageDirectory);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
42 if (!file) {
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
43 goto cleanup;
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
44 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
45
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
46 jmethodID getAbsolutePath = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, file),
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
47 "getAbsolutePath", "()Ljava/lang/String;");
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
48 jstring path = (*env)->CallObjectMethod(env, file, getAbsolutePath);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
49
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
50 char const *tmp = (*env)->GetStringUTFChars(env, path, NULL);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
51 ret = strdup(tmp);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
52 (*env)->ReleaseStringUTFChars(env, path, tmp);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
53
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
54 cleanup:
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
55 (*env)->PopLocalFrame(env, NULL);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
56 return ret;
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
57 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
58 #endif
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
59
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
60 void get_initial_browse_path(char **dst)
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
61 {
1858
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
62 char *base = NULL;
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
63 char *remember_path = tern_find_path(config, "ui\0remember_path\0", TVAL_PTR).ptrval;
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
64 if (!remember_path || !strcmp("on", remember_path)) {
1673
ab3b465c052c Fix Windows implentation of get_config_dir() so config file gets saved to the right place. Fix location for sticky_path file on all platforms
Michael Pavone <pavone@retrodev.com>
parents: 1524
diff changeset
65 char *pathfname = alloc_concat(get_userdata_dir(), PATH_SEP "blastem" PATH_SEP "sticky_path");
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
66 FILE *f = fopen(pathfname, "rb");
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
67 if (f) {
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
68 long pathsize = file_size(f);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
69 if (pathsize > 0) {
1858
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
70 base = malloc(pathsize + 1);
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
71 if (fread(base, 1, pathsize, f) != pathsize) {
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
72 warning("Error restoring saved file browser path");
1858
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
73 free(base);
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
74 base = NULL;
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
75 } else {
1858
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
76 base[pathsize] = 0;
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
77 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
78 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
79 fclose(f);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
80 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
81 free(pathfname);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
82 if (!current_path) {
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
83 atexit(persist_path);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
84 current_path = dst;
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
85 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
86 }
1858
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
87 if (!base) {
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
88 base = tern_find_path(config, "ui\0initial_path\0", TVAL_PTR).ptrval;
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
89 }
1858
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
90 if (!base){
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
91 #ifdef __ANDROID__
1858
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
92 base = get_external_storage_path();
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
93 #else
1858
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
94 base = "$HOME";
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
95 #endif
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
96 }
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
97 tern_node *vars = tern_insert_ptr(NULL, "HOME", get_home_dir());
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
98 vars = tern_insert_ptr(vars, "EXEDIR", get_exe_dir());
1858
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
99 *dst = replace_vars(base, vars, 1);
dda7479f3bbb Fix a couple of small memory leaks
Michael Pavone <pavone@retrodev.com>
parents: 1673
diff changeset
100 free(base);
1473
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
101 tern_free(vars);
152a60c6787e Moved initial path logic out of menu so it can be shared with new UI
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
102 }
1481
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
103
1489
637fbc3b5063 Added code to persist config back to a file
Michael Pavone <pavone@retrodev.com>
parents: 1481
diff changeset
104 char *path_append(const char *base, const char *suffix)
1481
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
105 {
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
106 if (!strcmp(suffix, "..")) {
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
107 #ifdef _WIN32
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
108 //handle transition from root of a drive to virtual root
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
109 if (base[1] == ':' && !base[2]) {
1524
b96f9fae757f Fix Windows build, added Windows default_font_path implementation
Michael Pavone <pavone@retrodev.com>
parents: 1489
diff changeset
110 return strdup(PATH_SEP);
1481
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
111 }
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
112 #endif
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
113 size_t len = strlen(base);
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
114 while (len > 0) {
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
115 --len;
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
116 if (is_path_sep(base[len])) {
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
117 if (!len) {
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
118 //special handling for /
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
119 len++;
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
120 }
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
121 char *ret = malloc(len+1);
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
122 memcpy(ret, base, len);
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
123 ret[len] = 0;
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
124 return ret;
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
125 }
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
126 }
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
127 return strdup(PATH_SEP);
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
128 } else {
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
129 #ifdef _WIN32
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
130 if (base[0] == PATH_SEP[0] && !base[1]) {
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
131 //handle transition from virtual root to root of a drive
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
132 return strdup(suffix);
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
133 }
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
134 #endif
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
135 if (is_path_sep(base[strlen(base) - 1])) {
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
136 return alloc_concat(base, suffix);
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
137 } else {
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
138 char const *pieces[] = {base, PATH_SEP, suffix};
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
139 return alloc_concat_m(3, pieces);
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
140 }
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
141 }
77a401044935 Fix directory navigation in ROM file chooser in Nuklear UI
Michael Pavone <pavone@retrodev.com>
parents: 1473
diff changeset
142 }