| 439 | } |
| 440 | |
| 441 | BOOL LASwriteOpener::set_directory(const CHAR* directory) |
| 442 | { |
| 443 | if (this->directory) free(this->directory); |
| 444 | if (directory) |
| 445 | { |
| 446 | if (strstr(directory, ";") || strstr(directory, "\"")) |
| 447 | { |
| 448 | LASMessage(LAS_WARNING, "specified '-odir' seems to contain a substring '\\\"' such\n" \ |
| 449 | "\tas -odir \"D:\\\" or -odir \"..\\tiles\\\". this command will\n" \ |
| 450 | "\tprobably fail. please use -odir \"D:\" or -odir \"..\\tiles\"\n" \ |
| 451 | "\tinstead."); |
| 452 | } |
| 453 | this->directory = LASCopyString(directory); |
| 454 | if (this->directory == nullptr) |
| 455 | { |
| 456 | return FALSE; |
| 457 | } |
| 458 | #pragma warning(push) |
| 459 | #pragma warning(disable : 6001) |
| 460 | I32 len = (I32)strlen(this->directory); |
| 461 | if ((len > 0) && ((this->directory[len-1] == '\\') || (this->directory[len-1] == '/'))) |
| 462 | { |
| 463 | this->directory[len-1] = '\0'; |
| 464 | } |
| 465 | if (file_name) add_directory(); |
| 466 | #pragma warning(pop) |
| 467 | // return FALSE if it does not exist or is no directory |
| 468 | |
| 469 | if ((len > 0) && (this->directory[len-1] != ':')) |
| 470 | { |
| 471 | las_stat_t info; |
| 472 | |
| 473 | if (stat_las(this->directory, &info) != 0) |
| 474 | { |
| 475 | return FALSE; |
| 476 | } |
| 477 | else if (!(info.st_mode & S_IFDIR)) |
| 478 | { |
| 479 | return FALSE; |
| 480 | } |
| 481 | } |
| 482 | } |
| 483 | else |
| 484 | { |
| 485 | this->directory = 0; |
| 486 | } |
| 487 | return TRUE; |
| 488 | } |
| 489 | |
| 490 | void LASwriteOpener::set_file_name(const CHAR* file_name) |
| 491 | { |
no test coverage detected