MCPcopy Create free account
hub / github.com/LAStools/LAStools / add_file_name

Method add_file_name

LASlib/src/lasreader.cpp:2596–2632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2594}
2595
2596BOOL LASreadOpener::add_file_name(const CHAR* file_name, BOOL unique) {
2597 BOOL r = FALSE;
2598 HANDLE h;
2599 WIN32_FIND_DATA info;
2600
2601 // extract the extension from the pattern
2602 std::string ext = getFileExtension(file_name);
2603
2604 h = FindFirstFile(file_name, &info);
2605 if (h != INVALID_HANDLE_VALUE) {
2606 // find the path
2607 I32 len = (I32)strlen(file_name);
2608 while (len && (file_name[len] != '\\') && (file_name[len] != '/') && (file_name[len] != ':')) len--;
2609 if (len) {
2610 len++;
2611 CHAR full_file_name[512];
2612 strncpy_las(full_file_name, sizeof(full_file_name), file_name, len);
2613 size_t remaining_size = (sizeof(full_file_name) > len) ? (sizeof(full_file_name) - len) : 0;
2614 do {
2615 // windows wildcards also return partial matches. Here a strict check is performed for the exact file ext
2616 if (!ext.empty() && !HasFileExt(info.cFileName, ext)) continue;
2617
2618 snprintf(&full_file_name[len], remaining_size, "%s", info.cFileName);
2619 if (add_file_name_single(full_file_name, unique)) r = TRUE;
2620 } while (FindNextFile(h, &info));
2621 } else {
2622 do {
2623 // windows wildcards also return partial matche. Here a strict check is performed for the exact file ext
2624 if (!ext.empty() && !HasFileExt(info.cFileName, ext)) continue;
2625
2626 if (add_file_name_single(info.cFileName, unique)) r = TRUE;
2627 } while (FindNextFile(h, &info));
2628 }
2629 FindClose(h);
2630 }
2631 return r;
2632}
2633#else
2634#include <dirent.h>
2635#include <glob.h>

Callers 14

mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
runMethod · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
mainFunction · 0.45
set_file_nameMethod · 0.45

Calls 9

getFileExtensionFunction · 0.85
strncpy_lasFunction · 0.85
HasFileExtFunction · 0.85
realloc_lasFunction · 0.85
malloc_lasFunction · 0.85
laserrorFunction · 0.85
emptyMethod · 0.80
initMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected