E Armitage wrote:Yes, the location of the files is not something you can control or influence in your application so it makes sense to make the user provide all of it.
Some people could be running on unix environments as well.
naresh saxena wrote:
E Armitage wrote:Yes, the location of the files is not something you can control or influence in your application so it makes sense to make the user provide all of it.
Some people could be running on unix environments as well.
One more thing is that I was thinking is that from the user will enter the complete path lets say c:/abc/def/Test and that we will accept it as string and based on that we will continue with our existing logic , please advise
E Armitage wrote:
Sounds viable. You have to worry about the validity of the entered path though because some users will enter an invalid path.
Another option is to add gui capabilities to the program and use a JFileChooser instead.
E Armitage wrote:You tell the chooser to select directories only using
See more details here:http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html
E Armitage wrote:Use chooser.getSelectedFile(); instead of chooser.getCurrentDirectory();
E Armitage wrote:You don't need to do
choosers.getSelectedFile() already returns a File so just assign that rather than creating another file object
E Armitage wrote:
E Armitage wrote:See the API specs for the JFileChooser constructor that takes a String. Careful that you don't resurrect the problem of coding to a specific platform. Remember that some users won't have a C:\\
You could try fiddling with things like File.listRoots to be sure but I'd think that most users would prefer the default to point to their own default documents folder than to the system's root folder.
There is no greater crime than stealing somebody's best friend. I miss you tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|