FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important
information on the platform change.
04-01-2022 07:31 PM - edited 04-01-2022 07:32 PM
I was trying to get the default path of the data folder available in the PLC application using the IL_DirGetCurrentAsycn and then browse the files with IL_DirReadAsync. However, apparently the max path that can be returned by the first block is 80 characters and the max path that can be recieved by the second is 80 characters. The path to the default data storage on the controller is longer than that.
Is there a way to change that?
Solved! Go to Solution.
04-04-2022 07:43 AM
As far as I know is this a hard coded restriction from the CodeSys function blocks. You can do a work around changing the root folder you are actually working on:
enResult := SysDirSetCurrent(szDir:=strRootPathBrowse);
04-04-2022 10:21 AM - edited 05-24-2022 10:12 AM
Yes, it's true the 80 char's are a limitation by the CoDeSys function which is used. The is a active request to CoDeSys to enlarge the string length. Right now, you can't retrieve longer path names than 80 char's. But you can set longer path names by splitting the path in pices of max. 80 char's.
Example you want to acces file: /myPathWith80Chars/subdir1/subDir2/myFileName.txt There are 2 ways to do it:
1) Use SysDirSetCurrent 2x.
- Set absolute path (with "/" at start of string) to: "/myPathWith80Chars/"
- Set relative path (without "/" at start of string) to: subdir1/subDir2
- Read or write file with file name "myFileName.txt"
2) Use SysDirSetCurrent 1x and relative file name
- Set absolute path (with "/" at start of string) to: "/myPathWith80Chars/"
- Read or write file with relative path and file name (without "/" at start of string) "subdir1/subDir2/myFileName.txt"
04-04-2022 02:37 PM
Is it possible to use a higher level directory. For example, let's say I want to copy data from a USB. Can I do something like '../../../media/sda1/' to get access from a directory?
04-04-2022 03:26 PM
Please have a look to this post for access to external storage from an application.