Resolve-Path gets an error if the file does not exist yet. #19
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi Rob,
after our chat at Directions I'm just trying to migrate our solution to XliffSync 😊 But for that we have to get the pipeline running. I'm calling the Powershell command like this
This should create a
Core.de-DE.xlf
which does not exist yet. The$targetPath
is currently determined on the relative path of the$sourcePath
variable. And the script works perfectly fine with that. But then it comes to$mergedDocument.SaveToFilePath($targetPath);
in theSync-XliffTranslations.ps1
file and the function wants to resolve the$targetpath
to get the full path (which does not exist) and throws an error.With this PR I would like to set the
$targetPath
directly with the full path by using the(Resolve-Path $sourcePath)
- because that file exists and the resolving will succeed.And then, in the
SaveToFilePath
function, I don't have to resolve it again (which still would fail as the file still does not exist) which is why I added theif(Test-Path $filePath)
. But as I then already have the full file path, the command$this.root.OwnerDocument.Save($filePath);
succeeds.I hope I could explain it good enough, so that you could follow me :D
All the best,
David