-
Notifications
You must be signed in to change notification settings - Fork 57
Suggestion: escape file path JSON file #52
Comments
Hi Jean-Francois, Could you escape the value in the variable directly? |
Problem is I use built-in VSTS variables (such as $(System.ArtifactsDirectory) ) as part of my variable value which itself isn't escaped. My workaround was to create a PowerShell task to set those variables in my .json file - but that defeats the purpose of (trying) to use tokens and a nice extension like this one. |
I'm curious as to how exactly you used a PowerShell task for this as I've run into the exact same issue using JSONs on TFS2017. If you could go into a bit more detail on your workaround that would be great. Thanks. |
I brute forced it - I just used powershell to explicitly take the parameters and replace them where they need to be set - there is no magical token replacement. |
OK, thanks for the reply. |
Hi,
This can be done using vsts agent commands (https://github.com/Microsoft/vsts-tasks/blob/master/docs/authoring/commands.md) |
Hi @jeanfrancoislarente and @samuelhl,
So if you put Would this evolution work for you? |
I imagine that would work? |
I just released v2.3.0 of the task which includes the 2 parameters to allow escaping characters. |
Hello,
I'm trying to use Replace Tokens to set a file path in a .json file.
My token is @@assets.root@@ and my variable has a normal file path. If this wasn't a .json file everything behaves as it should. However as you know in json the paths need to be escaped.
C:\my-path needs to be
c:\\my-path.
Just hoping that this would make it in future versions (logic to escape paths when target is .json extension).
The text was updated successfully, but these errors were encountered: