Commit 5ab7dc82 authored by Curtis Rose's avatar Curtis Rose
Browse files

Updated Cnetedit to throw error message if a nonexistent network file is...

Updated Cnetedit to throw error message if a nonexistent network file is entered. Message tells user the file doesn't exist. Fixes #4305

git-svn-id: http://subversion.wr.usgs.gov/repos/prog/isis3/trunk@7161 41f8697f-d340-4b68-9986-7bafba869bb8
parent 9def357f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -126,6 +126,13 @@ void IsisMain() {
  editLockedPoints = NULL;
  editLockedMeasures = NULL;

  // Test if file exists, throw exception if it does not, continue otherwise.
  FileName cnetInput(ui.GetFileName("CNET"));
  if (!cnetInput.fileExists()) {
    QString msg = "The control network [" + cnetInput.expanded() + "] entered for CNET does not exist.";
    throw IException(IException::User, msg, _FILEINFO_);
  }
  
  // If the user wants to keep a log, go ahead and populate it with all the
  // existing ignored points and measures
  ControlNet cnet(ui.GetFileName("CNET"));
+19 −0
Original line number Diff line number Diff line
APPNAME = cnetedit

include $(ISISROOT)/make/isismake.tsts

commands:
# Test with a non-existant file
	echo -e "Error Test: Non-existant file" > $(OUTPUT)/error_temp.txt;
	if [[ `$(APPNAME) CNET=$(INPUT)/cnet.net \
	  ONET=$(OUTPUT)/cnet.net \
	  2>> $(OUTPUT)/error_temp.txt \
	  > /dev/null` ]]; \
	then \
	  true; \
	fi;
	
	$(SED) 's+\[/.*/input/+\[input/+' $(OUTPUT)/error_temp.txt > $(OUTPUT)/error.txt;
	
# Cleanup
	$(RM) $(OUTPUT)/error_temp.txt;