comparison src/readpst.c @ 366:67a3ee227495

fix bug in code allowing folders containing multiple item types
author Carl Byington <carl@five-ten-sg.com>
date Mon, 24 Oct 2016 08:43:08 -0700
parents e4c414ff8fa2
children 6b7c19a820e1
comparison
equal deleted inserted replaced
365:e4c414ff8fa2 366:67a3ee227495
2223 2223
2224 sprintf(temp, "%s", f->name[t]); 2224 sprintf(temp, "%s", f->name[t]);
2225 check_filename(temp); 2225 check_filename(temp);
2226 while ((f->output[t] = fopen(temp, "r"))) { 2226 while ((f->output[t] = fopen(temp, "r"))) {
2227 DEBUG_INFO(("need to increase filename because one already exists with that name\n")); 2227 DEBUG_INFO(("need to increase filename because one already exists with that name\n"));
2228 DEBUG_INFO(("- increasing it to %s%d\n", f->name, x));
2229 x++; 2228 x++;
2230 sprintf(temp, "%s%08d", f->name, x); 2229 sprintf(temp, "%s%08d", f->name[t], x);
2231 DEBUG_INFO(("- trying \"%s\"\n", f->name)); 2230 DEBUG_INFO(("- bump file name and try \"%s\"\n", temp));
2232 if (x == 99999999) { 2231 if (x == 99999999) {
2233 DIE(("create_enter_dir: Why can I not create a folder %s? I have tried %i extensions...\n", f->name, x)); 2232 DIE(("create_enter_dir: Why can I not create a folder %s? I have tried %i extensions...\n", f->name[t], x));
2234 } 2233 }
2235 fclose(f->output[t]); 2234 fclose(f->output[t]);
2236 } 2235 }
2237 if (x > 0) { //then the f->name should change 2236 if (x > 0) { //then the f->name should change
2238 free (f->name[t]); 2237 free (f->name[t]);