1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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
|
#include <stdio.h>
#include <winpr/crt.h>
#include <winpr/path.h>
#include <winpr/tchar.h>
#include <winpr/winpr.h>
int TestPathShell(int argc, char* argv[])
{
const int paths[] = { KNOWN_PATH_HOME, KNOWN_PATH_TEMP,
KNOWN_PATH_XDG_DATA_HOME, KNOWN_PATH_XDG_CONFIG_HOME,
KNOWN_PATH_XDG_CACHE_HOME, KNOWN_PATH_XDG_RUNTIME_DIR,
KNOWN_PATH_XDG_CONFIG_HOME };
const char* names[] = { "KNOWN_PATH_HOME", "KNOWN_PATH_TEMP",
"KNOWN_PATH_XDG_DATA_HOME", "KNOWN_PATH_XDG_CONFIG_HOME",
"KNOWN_PATH_XDG_CACHE_HOME", "KNOWN_PATH_XDG_RUNTIME_DIR",
"KNOWN_PATH_XDG_CONFIG_HOME" };
int rc = 0;
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
for (size_t x = 0; x < sizeof(paths) / sizeof(paths[0]); x++)
{
const int id = paths[x];
const char* name = names[x];
{
char* path = GetKnownPath(id);
if (!path)
{
fprintf(stderr, "GetKnownPath(%d) failed\n", id);
rc = -1;
}
else
{
printf("%s Path: %s\n", name, path);
}
free(path);
}
{
char* path = GetKnownSubPath(id, "freerdp");
if (!path)
{
fprintf(stderr, "GetKnownSubPath(%d) failed\n", id);
rc = -1;
}
else
{
printf("%s SubPath: %s\n", name, path);
}
free(path);
}
}
return rc;
}
|