Guest User

Untitled

a guest
Apr 28th, 2012
21
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. Java Cross-Platfrom OS detection to declare file path location
  2. public class FileConfiguration {
  3.  
  4. private String checkOs() {
  5. String path = "";
  6. if (System.getProperty("os.name").startsWith("Windows")) {
  7. // includes: Windows 2000, Windows 95, Windows 98, Windows NT, Windows Vista, Windows XP
  8. path = "C://Users//...";
  9.  
  10. }
  11. elseif (System.getProperty("os.name").startsWith("Mac")) {
  12. path = "///Users//...";
  13. }
  14. return path;
  15.  
  16. }
  17.  
  18. // declare paths for file source and destination
  19. String destinationPath = path;
  20. String sourcePath = path;
  21.  
  22. if (a) {
  23. // code
  24. } else if (b) {
  25. // code
  26. }
Advertisement
Add Comment
Please, Sign In to add comment