javafx - How to append more than two folders to user.home java -
guys! i'm trying append folder user.home property. working nice, while i'm using 1 additional folder. when try make 2 additions (so looks user.home+folder1+folder2+folder3) trows --- java.lang.illegalargumentexception: folder parameter must valid folder--- . though there restriction, can't find out where.
string fullroute = null; file homedir = new file("mlog"); if (!siteco.geteditor().gettext().isempty() && !incidate.geteditor().gettext().isempty()) { homedir.mkdirs(); fullroute = system.getproperty("user.home") + file.separator + //savevarto.getlastvisiteddirectory() + savevarto.addpath(siteco.getvalue().tostring()) + file.separator + savevarto.addpath(incidate.getvalue().tostring()); } else {homedir.mkdirs(); // file.separator+homedir.tostring() - without fullroute = system.getproperty("user.home")+file.separator+homedir.tostring();} system.out.println(fullroute); filechooser.setinitialdirectory(new file(fullroute)); filechooser.getextensionfilters().addall( new filechooser.extensionfilter("xml files", "*.xml")); //sample of method public class variables{ public string addpath(string name) { if (!name.isempty()) { //file nou = new file(getlastvisiteddirectory() +"\\" + name); file nou = new file(name); if (!nou.exists()) { nou.mkdirs(); } else { system.out.println("folder exists"); } } else{name = null;} return name; }}
string fullroute = null; file homedir = new file(system.getproperty("user.home")); if (siteco.getvalue() !=null && incidate.getvalue() !=null) { system.out.println(savevarto.getmainfolder()); fullroute = homedir + file.separator + savevarto.getmainfolder() + file.separator + siteco.getvalue().tostring() + file.separator + incidate.getvalue().tostring(); } else { fullroute = homedir.tostring(); } system.out.println(fullroute); file fhd = new file(fullroute); if (!fhd.exists()) fhd.mkdirs(); filechooser.setinitialdirectory(fhd); filechooser.getextensionfilters().addall( new filechooser.extensionfilter("xml files", "*.xml"));
Comments
Post a Comment