Hi,
I found a bug in the "create package" command in cForge. Apperently spaces in the CWD are not permitted.
See the following output;
---------------------------------------------------------------------------- cforge started Build date: $WCNOW$ Revision based: $WCREV$ ---------------------------------------------------------------------------- Easy attach enabled. Now attach with debugger, and then press Enter here! CWD: C:\Users\user\Desktop\I2C mcp7941x User elevated: False default case: --create-package [INFO] Executing: C:\Program Files\CODESYS 3.5.14.0\CODESYS\CFORGE\Scripts\create-package.py [Exception] command create-package.py caused an exception: Traceback (most recent call last): File "C:\Program Files\CODESYS 3.5.14.0\CODESYS\CFORGE\Scripts\create-package.py", line 145, in <module> IOError: [Errno 2] Could not find a part of the path 'C:\Users\user\Desktop\I2C\license.txt'.: C:\Users\user\Desktop\I2C\license.txt ---------------------------------------------------------------------------- cforge finished. ----------------------------------------------------------------------------
As clearly seen, the original path is "C:\Users\user\Desktop\I2C mcp7941x"
But the output is being written to "C:\Users\user\Desktop\I2C\" which fails.
more posts ...
CWD is Current Working Directory as seen by the cforge c# application.
This is where the context menu is setup for the create package
https://forge.codesys.com/tol/cforge/code/HEAD/tree/trunk/cforge/cforge/Package/CFORGE/Setup.reg#l62
So it will be calling :
cmd /C cforge.exe --create-package C:\Users\user\Desktop\I2C mcp7941x
Code for cforge.exe is here:
https://forge.codesys.com/tol/cforge/code/HEAD/tree/trunk/cforge/cforge/Program.cs
So it can be seen it then passes those two arguments to the python script here:
https://forge.codesys.com/tol/cforge/code/HEAD/tree/trunk/cforge/cforge/Package/CFORGE/Scripts/create-package.py#
Using this helper function:
https://forge.codesys.com/tol/cforge/code/HEAD/tree/trunk/cforge/cforge/Helper.cs#l251
Ideally we only need to fix the setup.reg, so I think steps are:
1. Does it work if you open a cmd prompt and navigate to the directory, then type the command:
cforge.exe --create-package "C:\Users\user\Desktop\I2C mcp7941x"
2. If yes fix the setup.reg to put quotes around %V
3. If not, investigate further
I cannot try it out any more, but in hindsight, without even trying your suggestion I'd say point 2 is valid. Whenever spaces are present in a windows path, one must open and close the entire string with surrounding quotes. So It should be: "%V".
Last edit: aliazzz 2020-01-18
So we need someone to change setup.reg..
Replace:
%V
With:
\"%V\"
And then test if the problem is solved.
If still doesn't work, further investigation of how the C# program calls the python program
Why don't you do the change and test?
I haven't got write-access
I think the "pull request" workflow at the moment is as follows:
1. create a ticket
2. Checkout
3. Make changes
4. Test changes
5. Upload the changed files to the ticket and say "dear maintainer, please accept this change because...".
It's in the documentation somewhere.
OK, I will make the change and test. Will have to wait until next week.
File for testing attached
Steps to repeat:
1. Download and install cforge
2. Double click this attached file to install to registry
3. Reboot(?)
4. Checkout random repository using its cforge:// link to "D:\folder with a space\"
5. Right click that folder in explorer and "create package manifest"
==>IS: "can't find D:\folder\liscence.txt"
==>SHOULD: create manifest successfully
now testing! please wait
The registry patch for \"%V\" seems to work !**
Aliazzz
Last edit: aliazzz 2020-01-18
@Ingo
Please accept the change to the Setup.reg file, which puts quotes around the directory paths of shell commands to solve the problem of directories with spaces.
https://forge.codesys.com/tol/cforge/tickets/_discuss/thread/4441ef6b6f/32d9/attachment/I-Campbell.2020.01.18.19.50.Setup.reg
please see this positive tester note https://forge.codesys.com/tol/cforge/tickets/14/#32d9/4a66
@aliazzz
Thanks for the help testing and reporting!
I haven't seen any such postings on any PR workflow, but offcourse it sounds good.
A better way, if cforge can handle it, is to clone the project to the users home, then edit it and creat a PR to the original master. That workflow mimics GitHub. Is such a workflow and option? > Ticket idea!
see ticket request 78: Github like workflow for PR
Last edit: aliazzz 2020-01-18