Skip to content

Commit cf0a710

Browse files
committed
[rfile] Throw exception for .zip files
1 parent a70791d commit cf0a710

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

io/io/src/RFile.cxx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,17 @@ using ROOT::Experimental::Internal::RFileLog;
3030

3131
static void CheckExtension(std::string_view path)
3232
{
33-
if (ROOT::EndsWith(path, ".xml")) {
33+
// Throw an exception for all non-ROOT extensions that are supported by TFile.
34+
// We don't want to "accidentally" support them as this would require us to keep supporting them
35+
// "forever" and that would bite us back if we at some point change the implementation to not rely on TFile anymore.
36+
if (ROOT::EndsWith(path, ".xml"))
3437
throw ROOT::RException(R__FAIL("ROOT::RFile doesn't support XML files."));
35-
}
3638

37-
if (!ROOT::EndsWith(path, ".root")) {
39+
if (ROOT::EndsWith(path, ".zip"))
40+
throw ROOT::RException(R__FAIL("ROOT::RFile doesn't support Zip files."));
41+
42+
if (!ROOT::EndsWith(path, ".root"))
3843
R__LOG_INFO(RFileLog()) << "ROOT::RFile only supports ROOT files. The preferred file extension is \".root\"";
39-
}
4044
}
4145

4246
namespace {

0 commit comments

Comments
 (0)