I need to find the current dir of the loaded skill file to automatically load the other files in the folder.
I found that "get_filename(piport)" will return the skript name, but not the dir.
How could I do that?
Using your idea of get_filename(piport), I have expanded it a little to obtain the root of the directory name.
This seems a little clunky, and I have only tested it under a couple of conditions, but it seemed to work:
when(file = get_filename(piport)
;; expand the file using the SKILL path
matches = foreach(mapcar path getSkillPath()
when(isFile(strcat(path "/" file ))
simplifyFilename(strcat(path "/" file ))
full = car(setof(item matches item))
;; convert the path into a list of strings
;; and remove the filename from the list
path = remd(file parseString(full "/"))
;; convert the list of strings back into a
;; single string, prepending with "/" for a
;; fully qualified path
root = strcat("/" buildString(path "/"))
;; print and return the file directory root
printf("root dirname: %s\n" root)
In reply to skillUser:
Awesome. I modified it a little and it works perfect. Thanks for your help!