pcdshub / pytmc

Generate EPICS IOCs and records from TwinCAT projects - along with many TwinCAT project tools
https://pcdshub.github.io/pytmc/
Other
10 stars 11 forks source link

REF: always use colon delimiter for `pytmc template` #320

Closed klauer closed 1 year ago

klauer commented 1 year ago

Closes https://github.com/pcdshub/pytmc/issues/299

For pytmc template, always use a colon delimiter, regardless of the platform. That means that the input file should be of the form: input_filename:output_filename on Windows, Mac, Linux. (Previously this could have been input_filename;output_filename on Windows)

Some special handling is then required to parse these appropriately, since Windows paths can have colons in them. Two absolute paths could then look like C:\a\b.c.txt:C:\d\e\f.txt - confusingly enough. The algorithm here checks to see if the first file exists in the case where the delimiter itself is ambiguous.

A quicker hack/fix is already out on plcprog-console: (filename.rsplit(":", 1)) - because we only use one absolute filename, the output is relative to the IOC directory.

I don't think this is the cleanest solution, but it is a solution...

klauer commented 1 year ago

(Merging so we can test this with Patrick's updated project)