43{
44 bool isNetWorkConnected = IsNetWorkConnected();
45
47 {
49 st.name = item["login"];
50
51 if (!PathExist(GetExecutableDir() + PATH_SEPARATOR "Data" PATH_SEPARATOR "cache" PATH_SEPARATOR "github_avatars"))
52 {
53 MkDir(GetExecutableDir() + PATH_SEPARATOR "Data" PATH_SEPARATOR "cache" PATH_SEPARATOR "github_avatars");
54 }
55
56 if (!FileExists(GetExecutableDir() + PATH_SEPARATOR "Data" PATH_SEPARATOR "cache" PATH_SEPARATOR "github_avatars" PATH_SEPARATOR + st.name + "_" + std::string(item["node_id"])) && isNetWorkConnected)
57 {
58 std::string urlFull = item["avatar_url"];
59 std::string baseURL = urlFull.substr(0, 37);
60 std::string pathURL = urlFull.substr(38);
61 DownloadFile(baseURL, pathURL, GetExecutableDir() + PATH_SEPARATOR
62 "Data" PATH_SEPARATOR "cache" PATH_SEPARATOR
63 "github_avatars" PATH_SEPARATOR + st.name + "_" +
64 std::string(item["node_id"]));
65 }
66
67 st.avatar =
new Texture2D(GetExecutableDir() + PATH_SEPARATOR
"Data"
68 PATH_SEPARATOR "cache" PATH_SEPARATOR "github_avatars"
69 PATH_SEPARATOR + st.name + "_" +
70 std::string(item["node_id"]));
71 contributors.push_back(st);
72 }
73}
a class to store JSON values