FreeRDP
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
TestPathShell.c
1
2#include <stdio.h>
3#include <winpr/crt.h>
4#include <winpr/path.h>
5#include <winpr/tchar.h>
6#include <winpr/winpr.h>
7
8int TestPathShell(int argc, char* argv[])
9{
10 const int paths[] = { KNOWN_PATH_HOME, KNOWN_PATH_TEMP,
11 KNOWN_PATH_XDG_DATA_HOME, KNOWN_PATH_XDG_CONFIG_HOME,
12 KNOWN_PATH_XDG_CACHE_HOME, KNOWN_PATH_XDG_RUNTIME_DIR,
13 KNOWN_PATH_XDG_CONFIG_HOME };
14 const char* names[] = { "KNOWN_PATH_HOME", "KNOWN_PATH_TEMP",
15 "KNOWN_PATH_XDG_DATA_HOME", "KNOWN_PATH_XDG_CONFIG_HOME",
16 "KNOWN_PATH_XDG_CACHE_HOME", "KNOWN_PATH_XDG_RUNTIME_DIR",
17 "KNOWN_PATH_XDG_CONFIG_HOME" };
18 int rc = 0;
19
20 WINPR_UNUSED(argc);
21 WINPR_UNUSED(argv);
22
23 for (size_t x = 0; x < sizeof(paths) / sizeof(paths[0]); x++)
24 {
25 const int id = paths[x];
26 const char* name = names[x];
27 {
28 char* path = GetKnownPath(id);
29
30 if (!path)
31 {
32 (void)fprintf(stderr, "GetKnownPath(%d) failed\n", id);
33 rc = -1;
34 }
35 else
36 {
37 printf("%s Path: %s\n", name, path);
38 }
39 free(path);
40 }
41 {
42 char* path = GetKnownSubPath(id, "freerdp");
43
44 if (!path)
45 {
46 (void)fprintf(stderr, "GetKnownSubPath(%d) failed\n", id);
47 rc = -1;
48 }
49 else
50 {
51 printf("%s SubPath: %s\n", name, path);
52 }
53 free(path);
54 }
55 }
56
57 return rc;
58}