Eventually I realized, that there is no problem with custom paths to the application
folder. If you use a relative path it is always relative to "system", the standard location
of "application", and this is the reason why your code built wrong paths in case the
the application folder name was left untouched. But you can uncouple the application
folder by using an absolute path just as described in the User Guide.
So, the problem was with relative paths to "system" only and there is no need to modify
anything regarding "gApplicationFolder". Correct me if I am wrong.