Using PlatformIO in network drive

Hello. I started using platformIO and I like the software. I read a lot of documentation and was able to setup and make things work. This community also very useful. But now I have a problem, once the project is based in a network drive.

The shared network drive is //ccsrv/share/projects/project-name so I created a mapped network drive. I have //server/networkshare mapped to P:, so far so good.

P:/projects/project-name looks good but I have some problems:

FIRST in the file c_cpp_properties.json, the system replace the P: drive letter with a UNC path name
SECOND the UNC path name is wrong. we have only one / at beginning.

(sorry the image I uploaded was not accepted since I’m a new user)

I fixed this by hand, but the file is automatically generated and fix by hand does not work.

  1. The drive letter is not being used for some reason.
  2. the UNC path is wrong.

Now, once I run the compiler I have a lot of errors from CMD.EXE because UNC path not supported:

'\\path_to_project_on_network_drive'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
arm-none-eabi-g++: error: src\control.cpp: No such file or directory
arm-none-eabi-g++: fatal error: no input files
compilation terminated.

I believe the CMD.EXE does not support, maybe change to power shell?
Maybe the problem is with python itself?

We have some topics in this community with some solutions attempts, I tryed to
1-Set project to correct directory with pio settings set projects_dir (see here)
2-Create new key in windows register (see here)

But it is still NOT working in a network drive. Can someone clarify if this is a bug, or am I doing something wrong?

I was looking in the community forum and found several posts about this issue, I believe I am doing something wrong, since the problem was reported in the past. Maybe the problem is the CMD.EXE, that do not support UNC path.

  1. Maybe change the shell to powershell will help. I can see powershell as default shell when I use pio core, but not during compile.
  2. Maybe a way to use the mapped P: drive instead of UNC path will help.
    But I could not find a procedure to test 1 and 2.
    PS: PlatformIO is a very nice software, despite this issue I think is a well done project.

Sounds exactly like

can you add your info there to push the issue again?

Hello. Sorry the delay on replay, I moved the project to local disk for my daily work, but now I created a new Virtual Machine to test the issue more easily. I am using the latest versions and fresh windows install in the VM so we can have more freedom to edit/mode/delete as needed.

SCENARIO:
A virtual PC (local machine) with VS Code and Platform IO, Arduino project.
I have a network share ** \\ccsrv\Projetos\ ** and inside the network share a folder Projects

So the drive letter P: is mapped to shared folder \\ccsrv\Projetos and in the c_cpp_properties.json we have the correct path using the P: drive letter “P:/Projects/Server Modbus/include” and similar.

This is working fine, I expected the P: drive letter here.

However, the CMD.EXE is started with the UNC path

‘\CCSRV\Projetos\Projects\Server Modbus’
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.

In my system, the provided registry hack did not work, and in fact the registry edit only supress the warnings. I expected the “current directory” to be ‘P:\Projects\Server Modbus’ with the cmd.exe

But for some reason, the system uses the UNC path instead. Maybe upgrade the python version can help? Use the drive letter and not UNC path may fix.

Makes sense to use power shell instead cmd.exe? This seems a better solution.

Power shell is stable, and never had problems with power shell inside Platform IO. Please let me know if I can help with something else.

This info needs to be in the issue to push it to the developers.

Thank you I will place in the issues section. Is it a category in the forum?

No, in the Github Issue linked above.

Thank you again. It is posted in Gitbub, with some suggestions to help work this out.

I am not a young top programmer, but just an older mid-range one, and I had problems with UNC path before, guess what? Similar issue! My code was correct if you look at the text editor, but after compilation one \ disapear. Crazy!

I worked a lot to find that preprocessor understood \\ as a escape sequence and replaced the double \ with a single \, no compilation erros just a character disapear like magic. I was able to confirm this in the preprocessor file, before compilation.

Not usual for me this kind of advanced compilation with intermediate files to ckeck, just a mid-range guy remeber? But… I found it and solve it including a weird FOUR \ in the string. So each escape sequence left just one \ and it worked. FOUR \ became TWO \ after the preprocessor.

1 Like

Sorry, that was a historical issue. It looks like we have finally fixed it. Please re-test with pio upgrade --dev.

1 Like

Hello. I can see the network path correct now with the latest dev release.

I just have the warnings
‘\\ccsrv\Projetos\Projects\Server Modbus’
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.

because we are using cmd.exe to run the compilation, but because cmd.exe defaults to Windows directory the compilation is working. So the network path issue seems solved, and the cmd.exe your team can address with more time, I am not sure the implication about using power shell instead of cmd.exe.

I can report this is working for me too. Will try the register hack to hide the warning messages again, but I can live with the warnings since the build is working now.

Thank you.
Celso

???
I see absolutly no connection to my simple problem: I can’t use the sketches from my earlier work in Arduino IDE V1.X and V2.3.2

What should a PlatformIO beginner do in this situation ?