Established Fact: application does not need to be platform independent.
I have been sitting here for a while and I don't know why this is causing me so much of an issue. What I want to do is this:
1) check to see if a file exists
2) if it doesn't exist, create it and then let me know
3) if it does exist, don't try to write over it anyway, just do nothing and let me know
String pathToChange = "C:/Program Files/WOTA".replace("/", "\\");
JOptionPane.showMessageDialog(rootPane, pathToChange);
File file = new File(pathToChange);
if (!file.exists()) {
file.mkdirs();
if (file.mkdir()) {JOptionPane.showMessageDialog(rootPane, "C:/Program Files/WOTA was created."); }
else { JOptionPane.showMessageDialog(rootPane, "Did not create.");
}
}
I don't know why but this is giving me a lot of trouble but it is. Oh, and you'll notice that I am having a JOptionPanel (Dialog) pop up with the file name that it is trying to create so that I know what is getting handed off is correct.
Can anyone kindly point out why this is not working and what I will need to do to make it work. More importantly, since I am a prideful bastard and I don't like others doing my work for me, please tell me why it wouldn't work.
Btw, I am building all of this in NetBeans.
Thank you!