File Path Concatenation

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
jyoung
Posts: 667
Joined: Thu Jan 21, 2016 6:43 am
Location: Oklahoma City, OK USA

File Path Concatenation

Post by jyoung » Wed Jan 31, 2018 6:19 am

Is there a function, intrinsic or something that can concatenate file paths with the correct slashes for Windows and IBMi, kinda like how .NET's Path.Combine works?

I find myself doing this alot

Code: Select all

if (*OSAPI = IBMI)
#templatePath := 'templates/PTOTemplate.xlsx'
else
#templatePath := 'templates\PTOTemplate.xlsx'
endif
I could easily make something to handle it, but would rather use things that are baked into LANSA instead of rolling my own.

User avatar
Stewart Marshall
Posts: 417
Joined: Thu Nov 05, 2015 5:25 pm

Re: File Path Concatenation

Post by Stewart Marshall » Wed Jan 31, 2018 7:58 am

Hi Joe

If I recall correctly, the *PATHDELIM system variable will solve your problem

#templatePath := 'templates' + *PATHDELIM + 'PTOTemplate.xlsx'


Regards
Stewart Marshall

Independent IT Consultant
www.marshallfloyd.com.au

Post Reply