#include #include #include #include #include int TestPathMakePath(int argc, char* argv[]) { int x; BOOL success; char tmp[64]; char* path; char* base = GetKnownPath(KNOWN_PATH_TEMP); if (!base) { fprintf(stderr, "Failed to get temporary directory!\n"); return -1; } srand(time(NULL)); for (x=0; x<5; x++) { sprintf(tmp, "%08X", rand()); path = GetCombinedPath(base, tmp); free(base); if (!path) { fprintf(stderr, "GetCombinedPath failed!\n"); return -1; } base = path; } printf("Creating path %s\n", path); success = PathMakePathA(path, NULL); if (!success) { fprintf(stderr, "MakePath failed!\n"); free (path); return -1; } success = PathFileExistsA(path); if (!success) { fprintf(stderr, "MakePath lied about success!\n"); free (path); return -1; } free (path); printf("%s success!", __FUNCTION__); return 0; }