In the view I have a text field in which I indicate the address where I will save the file next to the name that I want to place it.
String direccion = vista.txtFileRespaldar.getText();
This is converted to type file
in the following way:
File dir= new File (direccion);
I check if the address is valid and proceed to the backup of the db:
if(direccion.isEmpty()){
JOptionPane.showMessageDialog(vista, "Debe indicar una ruta", "Error", JOptionPane.ERROR_MESSAGE);
}else if(dir.exists()){
boolean hecho=modelo.BD_backup(direccion);
if(hecho){
System.out.println("terminado backup " + dir);
}else{
JOptionPane.showMessageDialog(vista, "Error al intentar realizar el backup", "Error", JOptionPane.ERROR_MESSAGE);
}
}else{
System.out.println("error en backup" + dir);
JOptionPane.showMessageDialog(vista, "Debe indicar una ruta valida", "Error", JOptionPane.ERROR_MESSAGE);
}
I indicate any route on my PC and it tells me that the route is not valid, that is, the last else
.
Try indicating the path and name of a .backup file already created and backing it correctly.
Some idea of why?