Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/5971.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed case-sensitivity in isisimport on linux, now can succeed whether data file is upper or lowercase.
38 changes: 23 additions & 15 deletions isis/src/base/apps/isisimport/isisimport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,22 +347,30 @@ namespace Isis {


ProcessImport importer;
if (inputFileName.removeExtension().addExtension("dat").fileExists()){
importer.SetInputFile(inputFileName.removeExtension().addExtension("dat").expanded());
}
else if (inputFileName.removeExtension().addExtension("img").fileExists()) {
importer.SetInputFile(inputFileName.removeExtension().addExtension("img").expanded());
}
else if (inputFileName.removeExtension().addExtension("QUB").fileExists()) {
importer.SetInputFile(inputFileName.removeExtension().addExtension("QUB").expanded());
}
else if (inputFileName.removeExtension().addExtension("tif").fileExists()) {
QString msg = "GeoTIFFs may contain ancillary data that isisimport cannot process. "
"Please convert the .TIF to a cube using another tool, such as gdal_translate.";
throw IException(IException::User, msg, _FILEINFO_);
Comment thread
jrcain-usgs marked this conversation as resolved.
importer.SetInputFile(inputFileName.expanded());

// Check for files that match the from= file, except with these file extensions.
// If found, replace the data filename to import. Check upper and lower cases for linux compatibility.
QString fileExtensions[] = {"dat", "img", "qub"};
bool foundDataFile = false;

for (const QString& ext : fileExtensions) {
if(inputFileName.setExtension(ext).fileExists()){
importer.SetInputFile(inputFileName.expanded());
break;
}
else if(inputFileName.setExtension(ext.toUpper()).fileExists()){
importer.SetInputFile(inputFileName.expanded());
break;
}
}
else {
importer.SetInputFile(inputFileName.expanded());

if (!foundDataFile) {
if (inputFileName.setExtension("tif").fileExists() || inputFileName.setExtension("TIF").fileExists()) {
QString msg = "GeoTIFFs may contain ancillary data that isisimport cannot process. "
"Please convert the .TIF to a cube using another tool, such as gdal_translate.";
throw IException(IException::User, msg, _FILEINFO_);
}
Comment thread
jrcain-usgs marked this conversation as resolved.
Outdated
}

// Use inja to get number of lines, samples, and bands from the input label
Expand Down
Loading