From a9bcc81f821d7c66f623779fa5147e728eb3c388 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 4 May 2024 03:24:41 +0200 Subject: Adding upstream version 3.3.0+dfsg1. Signed-off-by: Daniel Baumann --- winpr/libwinpr/path/test/TestPathShell.c | 58 ++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 winpr/libwinpr/path/test/TestPathShell.c (limited to 'winpr/libwinpr/path/test/TestPathShell.c') diff --git a/winpr/libwinpr/path/test/TestPathShell.c b/winpr/libwinpr/path/test/TestPathShell.c new file mode 100644 index 0000000..1925fea --- /dev/null +++ b/winpr/libwinpr/path/test/TestPathShell.c @@ -0,0 +1,58 @@ + +#include +#include +#include +#include +#include + +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; +} -- cgit v1.2.3