Changeset 2756 for GTP/trunk/App/Demos/Vis/CHC_revisited/common.cpp
- Timestamp:
- 06/13/08 18:06:32 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/CHC_revisited/common.cpp
r2753 r2756 35 35 36 36 37 37 38 Real Random(Real max) 38 39 { … … 57 58 } 58 59 59 void 60 Randomize(const unsigned int seed)61 { 62 60 61 void Randomize(const unsigned int seed) 62 { 63 srand(seed); 63 64 } 64 65 … … 299 300 } 300 301 301 302 #if TOIMPLEMENT 303 304 bool 305 CreateDir(char *dir) 306 { 307 #ifdef _MSC_VER 308 HANDLE fFile; // File Handle 309 WIN32_FIND_DATA fileinfo; // File Information Structure 310 int n = strlen(dir) - 1; 311 312 if (dir[n] == '\\' || dir[n] == '/') 313 dir[n]=0; 314 315 fFile = FindFirstFile(dir, &fileinfo); 316 317 // if the file exists and it is a directory 318 if (fileinfo.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY) { 319 // Directory Exists close file and return 320 FindClose(fFile); 321 return true; 322 } 323 324 FindClose(fFile); 325 326 // Now lets cycle through the String Array and create each directory in turn 327 if (CreateDirectory(dir, 0)) { 328 SetFileAttributes(dir, FILE_ATTRIBUTE_NORMAL); 329 return true; 330 } else { 331 char *temp = GetPath(dir); 332 333 if (strcmp(temp, dir)!=0) { 334 CreateDir(temp); 335 if (CreateDirectory(dir, 0)) { 336 SetFileAttributes(dir, FILE_ATTRIBUTE_NORMAL); 337 return true; 338 } 339 } 340 delete temp; 341 } 342 Debug << "cannot create directory " << dir << endl; 343 #endif 344 return false; 345 } 346 347 348 #endif 349 350 } 302 }
Note: See TracChangeset
for help on using the changeset viewer.