-1

By equivalence, i mean logical equivalence, not the String comparison. E.g. if I do Files.newBufferedReader(Paths.get("file.txt", System.getProperty("user.home")) and Files.newBufferedReader(Paths.get("~").resolve(Paths.get("file.txt"))), will I get the same file on Windows and other systems?

sandwwraith
  • 299
  • 1
  • 2
  • 10

1 Answers1

1

Of course no. Tilde character has special meaning in shell. It points to HOME variable. In Java ~ is like any other file name. In addition in Windows you cannot use ~ as home directory equivalent.

Koziołek
  • 2,791
  • 1
  • 28
  • 48