Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve-Path gets an error if the file does not exist yet. #19

Merged
merged 1 commit into from
Nov 23, 2021

Conversation

DavidFeldhoff
Copy link
Contributor

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

Sync-XliffTranslations -sourcePath .\Translations\Core.g.xlf -targetLanguage 'de-DE' -parseFromDeveloperNote -parseFromDeveloperNoteOverwrite -parseFromDeveloperNoteSeparator "||" -detectSourceTextChanges $false -reportProgress

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 the Sync-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 the if(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

@rvanbekkum
Copy link
Owner

Hi David,
Thanks. Your explanation makes sense to me. 😊 Thanks for the PR. I have checked it and it looks good to me, so I'll merge it into the develop branch for the next release.

@rvanbekkum rvanbekkum merged commit f356962 into rvanbekkum:develop Nov 23, 2021
@DavidFeldhoff
Copy link
Contributor Author

Maybe one last question: When do you think you are doing the next release?

@rvanbekkum
Copy link
Owner

Not sure yet actually. I could do an intermediate release that has your change in it somewhere in the upcoming days, and later on look into adding the new enhancements from the new open issues and PRs for the version after that. 😃

@DavidFeldhoff
Copy link
Contributor Author

If there would be an intermediate release, that would be great :)
As we currently dug quite deep in how to resolve all DEU translations to de-DE translations etc. and finally managed to find a regex that matches all our code, but we cannot switch to that until the powershell module isn't working in the pipelines as we wouldn't have translations for our releases 😇

@rvanbekkum
Copy link
Owner

I have just published version 1.4.0 to PowerShell Gallery!

@rvanbekkum rvanbekkum added the bug Something isn't working label Nov 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants