Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File System Help

Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could someone point me to or give me a good explanation/example of dealing with the location of files within the filesystem. I need to be able to do this on different OS's, but without having to explicitly do the same action 2 different ways and use an if statement to choose every time. I have looked at the java docs on File but it didn't get me very far. I also looked at the Java Tutorial, but it didn't help much either
I need to be able to:

  • findout what the working directory is
  • change the working directory to the location of my program if need be. Once there, I could probably solve the next issue.
  • store a set of resource directories between program sessions. I suppose this could be done with a text file, but I have to know the path to that file so I can open it.
  • avoid hardcoding paths into my code.

  • These are the things I am having a hard time figuring out. Any help with some or all of them would be appreciated.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic