Class PathResolver
java.lang.Object
be.kuleuven.cs.distrinet.sparta.cli.PathResolver
Small pure helper for resolving user-supplied model/output paths. Splitting
this out of the CLI/CI bootstrap keeps the path handling unit-testable and
avoids the fragile
user.dir + "/" + target concatenation that
mishandles absolute paths and platform separators.-
Method Summary
-
Method Details
-
resolve
Resolve a possibly-relativetargetagainstbaseDir. Iftargetis already absolute it is returned unchanged (the base dir is ignored); otherwise it is resolved as a child ofbaseDir. Platform separators are handled byFile.- Parameters:
baseDir- the base directory (typicallyuser.dir)target- the user-supplied path- Returns:
- the resolved file
-
toFileURI
ResolvetargetagainstbaseDirand turn the result into an EMF fileURI. UsesURI.createFileURI(String)on the absolute path so separators and drive letters are encoded correctly.- Parameters:
baseDir- the base directory (typicallyuser.dir)target- the user-supplied path- Returns:
- the file URI for the resolved path
-