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

Guidance on acceptable paths is not discoverable #16029

Open
jeskew opened this issue Jan 6, 2025 · 0 comments
Open

Guidance on acceptable paths is not discoverable #16029

jeskew opened this issue Jan 6, 2025 · 0 comments

Comments

@jeskew
Copy link
Contributor

jeskew commented Jan 6, 2025

First reported by @TheOnlyWei in #15994 (reply in thread)

Anywhere Bicep accepts a path (module and import statements; load*Content functions), it must be a relative path that uses a / directory separator to ensure portability. However, this isn't very discoverable if you start out with an absolute Windows path.

param test string = loadTextContent('C:\<insert home path>\.ssh\id_rsa.pub')

will confusingly report that the value must be a compile time constant. Not sure what causes that, but I think \< confuses the lexer somehow. Using a path with no placeholders:

param test string = loadTextContent('C:\Users\jeskew\.ssh\id_rsa.pub')

will report that the string contains illegal escape sequences. Escaping the backslashes:

param test string = loadTextContent('C:\\Users\\jeskew\\.ssh\\id_rsa.pub')

will report that the string contains an illegal : character. Removing the drive:

param test string = loadTextContent('\\Users\\jeskew\\.ssh\\id_rsa.pub')

will finally report that the / directory separator needs to be used instead of \. Replacing the directory separators:

param test string = loadTextContent('/Users/jeskew/.ssh/id_rsa.pub')

will report that paths need to be relative, not absolute.

That's a lot of iteration! Maybe we should put more guidance in earlier messages or in the load*Content function descriptions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

1 participant