diff --git a/frmts/tiledb/tiledbcommon.cpp b/frmts/tiledb/tiledbcommon.cpp index 010ab1345f13..6d016ded5873 100644 --- a/frmts/tiledb/tiledbcommon.cpp +++ b/frmts/tiledb/tiledbcommon.cpp @@ -118,33 +118,11 @@ CPLErr TileDBDataset::AddFilter(tiledb::Context &ctx, int TileDBDataset::Identify(GDALOpenInfo *poOpenInfo) { - if (STARTS_WITH_CI(poOpenInfo->pszFilename, "TILEDB:")) + int nRet = TileDBDriverIdentifySimplified(poOpenInfo); + if (nRet == GDAL_IDENTIFY_UNKNOWN) { - return TRUE; - } - - try - { - const char *pszConfig = - CSLFetchNameValue(poOpenInfo->papszOpenOptions, "TILEDB_CONFIG"); - - if (pszConfig != nullptr) - { - return TRUE; - } - - const bool bIsS3OrGS = - STARTS_WITH_CI(poOpenInfo->pszFilename, "/VSIS3/") || - STARTS_WITH_CI(poOpenInfo->pszFilename, "/VSIGS/"); - // If this is a /vsi virtual file systems, bail out, except if it is S3 or GS. - if (!bIsS3OrGS && STARTS_WITH(poOpenInfo->pszFilename, "/vsi")) - { - return false; - } - - if (poOpenInfo->bIsDirectory || - (bIsS3OrGS && - !EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "tif"))) + nRet = FALSE; + try { tiledb::Context ctx; CPLString osArrayPath = @@ -170,13 +148,11 @@ int TileDBDataset::Identify(GDALOpenInfo *poOpenInfo) return eType == tiledb::Object::Type::Array; } } - - return FALSE; - } - catch (...) - { - return FALSE; + catch (...) + { + } } + return nRet; } /************************************************************************/ diff --git a/frmts/tiledb/tiledbdrivercore.cpp b/frmts/tiledb/tiledbdrivercore.cpp index 9d85d2ea5ec6..7a3421d6b899 100644 --- a/frmts/tiledb/tiledbdrivercore.cpp +++ b/frmts/tiledb/tiledbdrivercore.cpp @@ -35,7 +35,7 @@ /* TileDBDriverIdentifySimplified() */ /************************************************************************/ -static int TileDBDriverIdentifySimplified(GDALOpenInfo *poOpenInfo) +int TileDBDriverIdentifySimplified(GDALOpenInfo *poOpenInfo) { if (STARTS_WITH_CI(poOpenInfo->pszFilename, "TILEDB:")) @@ -51,6 +51,11 @@ static int TileDBDriverIdentifySimplified(GDALOpenInfo *poOpenInfo) return TRUE; } + if (!poOpenInfo->bIsDirectory) + { + return false; + } + const bool bIsS3OrGS = STARTS_WITH_CI(poOpenInfo->pszFilename, "/VSIS3/") || STARTS_WITH_CI(poOpenInfo->pszFilename, "/VSIGS/"); // If this is a /vsi virtual file systems, bail out, except if it is S3 or GS. @@ -59,17 +64,7 @@ static int TileDBDriverIdentifySimplified(GDALOpenInfo *poOpenInfo) return false; } - if (poOpenInfo->bIsDirectory) - { - return GDAL_IDENTIFY_UNKNOWN; - } - - if (bIsS3OrGS && !EQUAL(CPLGetExtension(poOpenInfo->pszFilename), "tif")) - { - return GDAL_IDENTIFY_UNKNOWN; - } - - return FALSE; + return GDAL_IDENTIFY_UNKNOWN; } /************************************************************************/ diff --git a/frmts/tiledb/tiledbdrivercore.h b/frmts/tiledb/tiledbdrivercore.h index 26e0e16aea83..632d945bee80 100644 --- a/frmts/tiledb/tiledbdrivercore.h +++ b/frmts/tiledb/tiledbdrivercore.h @@ -36,6 +36,8 @@ constexpr const char *DRIVER_NAME = "TileDB"; #define TileDBDriverSetCommonMetadata \ PLUGIN_SYMBOL_NAME(TileDBDriverSetCommonMetadata) +int TileDBDriverIdentifySimplified(GDALOpenInfo *poOpenInfo); + void TileDBDriverSetCommonMetadata(GDALDriver *poDriver); #endif