I have a strange problem with environment PATH value using getenv function (on Windows platform).
#include <stdio.h>
#include <stdlib.h>
int main()
{
puts(getenv("PATH"));
return 0;
}
If I run/debug the above program in CB, anything like "c:\some\dir" with surrounding quotes becomes something like \\"c\some\dir". Note the text is shown verbatim, and note the missing colon ( : ). It seems CB does not like leading quote char in PATH value.
If I run my program directly without CB IDE, the quoted path string is normal.
I verified this in old 17.12 which demonstrated same behavior. So it's an old bug but not disovered/reported by anyone.
Just curious, why does CB touch PATH value?
If I run/debug the above program in CB, anything like "c:\some\dir" with surrounding quotes becomes something like \\"c\some\dir". Note the text is shown verbatim, and note the missing colon ( : ). It seems CB does not like leading quote char in PATH value.
Just curious, why does CB touch PATH value?
I can confirm the issue on Windows 10 with C::B 20.03. Quotation marks in PATH must be rare, I had none there and had to add such a path manually. I am not sure if those are even allowed there, as it seems paths with folders having spaces in them (e.g., "Program Files (x86)") work just fine without them.
If you take a look at the output of your program, it becomes clear why C::B modifies the PATH: It prepends the current folder alias as well as the compiler path and its bin subfolder to it, so in my case it prepended
.;C:\msys64\mingw32\bin;C:\msys64\mingw32;