Commit f9f9675d authored by mercury233's avatar mercury233

Merge branch 'master' of https://github.com/Fluorohydride/ygopro into server-link

parents 9850f26a 96b57ccd
...@@ -813,23 +813,14 @@ void Game::LoadExpansionDB() { ...@@ -813,23 +813,14 @@ void Game::LoadExpansionDB() {
#else #else
DIR * dir; DIR * dir;
struct dirent * dirp; struct dirent * dirp;
const char *foldername = "./expansions/"; if((dir = opendir("./expansions/")) != NULL) {
if((dir = opendir(foldername)) != NULL) {
while((dirp = readdir(dir)) != NULL) { while((dirp = readdir(dir)) != NULL) {
size_t len = strlen(dirp->d_name); size_t len = strlen(dirp->d_name);
if(len < 5 || strcasecmp(dirp->d_name + len - 4, ".cdb") != 0) if(len < 5 || strcasecmp(dirp->d_name + len - 4, ".cdb") != 0)
continue; continue;
char *filepath = (char *)malloc(sizeof(char)*(len + strlen(foldername))); char filepath[1000];
strncpy(filepath, foldername, strlen(foldername) + 1); sprintf(filepath, "./expansions/%s", dirp->d_name);
strncat(filepath, dirp->d_name, len);
#ifdef YGOPRO_SERVER_MODE
dataManager.LoadDB(filepath); dataManager.LoadDB(filepath);
#else
std::cout << "Found file " << filepath << std::endl;
if(!dataManager.LoadDB(filepath))
std::cout << "Error loading file" << std::endl;
#endif
free(filepath);
} }
closedir(dir); closedir(dir);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment