Checked all possible use cases, there are still issues you seem to have overlooked.
Didn't it appear to be trivial at first glance? I am surprised myself.
The itemDel at line 97 needs to be set to "/" (see line 110 and 111 of your additions).
Then the comma delimiter needs to be declared somewhere after your additions.
Line 104 needs to be replaced with the following code otherwise gAPPPATH is not
an absolute path in case the app folder is located at the root directory:
```
if byte 1 of gApplicationFolder is "/" then
  put gApplicationFolder & "/" into gAPPPATH
else
  # app folder is in the index directory folder
  put item 1 to -2 of sTempPath & "/" & gApplicationFolder & "/" into gAPPPATH
end if
```