Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

pubzzle of db-file-path expression?

 
he qinfeng
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone:
When the program run in local mode,it allow user to input the db-file-path and db-file-name.if the db file located E:\javacode\db.db,the db-file-path is E:\javacode\ or E:\javacode in JTextField?
I think E:\javacode\ is better,db-file-path add db-file-name is ok.But E:\javacode is familiar with user ,and if on Win32,db-file-path + "\" + db-file-name is ok,if on Solaris,db-file-path + "/" + db-file-name is ok,it's difficult to judgement.
Thanks for your answer.
 
Charlie Goth
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JFileChooser
 
Pedro Penna
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are other classes in the swing package that you could use for the input of the db-file-path, instead of using JTextField.

And the normal slash '/' is the default directory separator. For example, the path "dir1/dir2/file.db" is compatible with Windows.
 
he qinfeng
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
JFileChooser is the better way,and I will use it to work out.
 
Jon Entwistle
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi He,

Just for reference, you can always access the system dependant seperator from the static File.separator variable.

Regards,

Jon
 
he qinfeng
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Entwistle.
By your opinion,I also solved my problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic