Tech Tip: METHOD GET CODE Uses Carriage Return
PRODUCT: 4D | VERSION: 13.0 | PLATFORM: Mac & Win
Published On: June 2, 2012
The command METHOD GET CODE is used to retreive the source code of a method. It is important to note that the line endings returned by METHOD GET CODE are carriage returns (CR's). This is important especially when saving the code to a file on disk.
Conversion to the following line-endings is recommended:
Platform | Ending |
Windows | CRLF |
Mac OS X | LF |
Cross-platform | LF |
Here is an example that converts the line-endings to LF:
METHOD GET CODE($methodPath_t;$body_t) $body_t:=Replace string($body_t;Char(Carriage return);Char(Line feed)) |
Side Note: git does not support bare CR's for text file line endings. If you use bare CR line endings, git will treat the file as one line and diff'ing does not work.