1
10
13
14
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
92
93
94
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
125
126
127
128
129
130
131
132
137
138
139
144
145
146
147
148
149
150
151
157
158
159
160
161
162
169
170
171
178
179
180
186
187
188
189
190
191
192
193
194
200
201
202
214
215
216
217
223
224
225
231
237
238
239
240
241
242
243
249
250
251
252
253
254
...
...
...
#define FX_SOURCE_CODE
#include "fx_api.h"
#include "fx_utility.h"
#ifdef FX_ENABLE_EXFAT...
...
UINT _fx_utility_absolute_path_get(CHAR *base_path, CHAR *new_path, CHAR *absolute_path)
{
UINT length;
UINT absolute_position;
UINT i;
if (!base_path || !new_path || !absolute_path)
{
return(FX_INVALID_PATH);
}if (!base_path || !new_path || !absolute_path) { ... }
if ((new_path[0] == '\\') || (new_path[0] == '/'))
{
absolute_path[0] = '\\';
absolute_path[1] = 0;
new_path++;
}if ((new_path[0] == '\\') || (new_path[0] == '/')) { ... }
else
{
i = 0;
while ((base_path[i]) && (i < FX_MAXIMUM_PATH))
{
absolute_path[i] = base_path[i];
i++;
}while ((base_path[i]) && (i < FX_MAXIMUM_PATH)) { ... }
if ((absolute_path[0] == 0) || (i == 0))
{
absolute_path[0] = '\\';
absolute_path[1] = 0;
}if ((absolute_path[0] == 0) || (i == 0)) { ... }
}else { ... }
while ((length = _fx_utility_token_length_get(new_path)) > 0)
{
if ((new_path[length] != 0) && (new_path[length] != '\\') && (new_path[length] != '/'))
{
return(FX_INVALID_PATH);
}if ((new_path[length] != 0) && (new_path[length] != '\\') && (new_path[length] != '/')) { ... }
if ((length == 1) && (new_path[0] == '.'))
{
}if ((length == 1) && (new_path[0] == '.')) { ... }
else if ((length == 2) && (new_path[0] == '.') && (new_path[1] == '.'))
{
absolute_position = _fx_utility_string_length_get(absolute_path, FX_MAXIMUM_PATH);
if ((absolute_position < 2) || (absolute_path[absolute_position] != 0))
{
return(FX_INVALID_PATH);
}if ((absolute_position < 2) || (absolute_path[absolute_position] != 0)) { ... }
absolute_position--;
if ((absolute_path[absolute_position] == '\\') || (absolute_path[absolute_position] == '/'))
{
absolute_path[absolute_position] = 0;
absolute_position--;
}if ((absolute_path[absolute_position] == '\\') || (absolute_path[absolute_position] == '/')) { ... }
while ((absolute_path[absolute_position] != '\\') && (absolute_path[absolute_position] != '/') && (absolute_position > 0))
{
absolute_path[absolute_position] = 0;
absolute_position--;
}while ((absolute_path[absolute_position] != '\\') && (absolute_path[absolute_position] != '/') && (absolute_position > 0)) { ... }
if (absolute_position > 1)
{
absolute_path[absolute_position] = 0;
}if (absolute_position > 1) { ... }
}else if ((length == 2) && (new_path[0] == '.') && (new_path[1] == '.')) { ... }
else
{
absolute_position = _fx_utility_string_length_get(absolute_path, FX_MAXIMUM_PATH);
if (absolute_path[absolute_position] != 0)
{
return(FX_INVALID_PATH);
}if (absolute_path[absolute_position] != 0) { ... }
if (absolute_position)
{
if ((absolute_path[absolute_position - 1] != '\\') && (absolute_path[absolute_position - 1] != '/'))
{
absolute_path[absolute_position] = '\\';
absolute_position++;
}if ((absolute_path[absolute_position - 1] != '\\') && (absolute_path[absolute_position - 1] != '/')) { ... }
}if (absolute_position) { ... }
i = 0;
while ((absolute_position < FX_MAXIMUM_PATH) && (i < length))
{
absolute_path[absolute_position++] = new_path[i++];
}while ((absolute_position < FX_MAXIMUM_PATH) && (i < length)) { ... }
if (absolute_position < FX_MAXIMUM_PATH)
{
absolute_path[absolute_position] = 0;
}if (absolute_position < FX_MAXIMUM_PATH) { ... }
else
{
return(FX_INVALID_PATH);
}else { ... }
}else { ... }
new_path += length;
if ((new_path[0] == '\\') || (new_path[0] == '/'))
{
new_path++;
}if ((new_path[0] == '\\') || (new_path[0] == '/')) { ... }
}while ((length = _fx_utility_token_length_get(new_path)) > 0) { ... }
return(FX_SUCCESS);
}_fx_utility_absolute_path_get (CHAR *base_path, CHAR *new_path, CHAR *absolute_path) { ... }
/* ... */#endif