How can I support something such as: Dim fh As FolderItem = GetFolderItem(args(1))
?
This works fine as long as args(1)
is a full path. For example, one has to:
$ pwd
/home/jeremy/projects/playing
$ ls
hi.txt my-xojo-program
$ ./my-xojo-program /home/jeremy/projects/playing/hi.txt
Typing things such as:
$ ./my-xojo-program ./hi.txt
Fails with the error:
Exception message: Passing non-absolute shell paths is not currently supported
I’m sure there has to be clever work arounds that others have already discovered to make something like this work.
Thanks!
maybe
Dim fh As FolderItem = GetFolderItem(args(1), FolderItem.PathTypeShell)
Nope, FolderItem.PathTypeShell
fixes nothing, same error. I actually meant to put that in the above example, sorry about that. Forgot to include it.
Dim fh As FolderItem = GetFolderItem("").Child(args(1))
?
Wayne,
Nope, tried that one also. GetFolderItem("")
returns the path of the executable. So, let’s say you install your program into /usr/local/bin
and then did something like:
$ pwd
/home/jeremy
$ which import-file
/usr/local/bin/import-file
$ import-file hello.txt
The code from GetFolderItem("").Child(args(1))
would return /usr/local/bin/hello.txt
. If you try to be smart and pass ./hello.txt
then it will fail with the original error. Seems .Child()
will not take a non-absolute path either.