I have a java.nio.file.Path
object that represents some directory (e.g., /var/log
). I want a new Path object representing a file within the directory (e.g., /var/log/something.log
). I have been using
Path logDir = ...
Path logFile = Paths.get(logDir.toString(), "something.log");
But it seems silly to have to turn logDir into a string, then construct the new Path object. How can I get the logFile object but without using toString? E.g.,
Path logDir = ...
Path logFile = Paths.get(logDir, "something.log"); // Doesn't exist