java - Cross-platform file path building and representation -
i in refactoring stage project working on , make improvements how build , represent file system paths. things should take consideration when representing relative paths in java code ensure compatibility on ubuntu, osx, , windows 7.
currently instance of file referencing "myproject/foo/bar.f" have code along lines of:
file bar = new file(projectdirectory + "/" + fooresourcedirectory + "/" + barname);
this seems wrong several reasons, of best practices?
perhaps use constructors provided sort of thing:
new file(parent, child) you have "nest" them, it's trivial handle (e.g. make function path built taking string....)
Comments
Post a Comment