FolderItem confusion

dim s as string
s="Macintosh HD:Users:daveS:Desktop:myfile.txt"

I am getting this string and need to convert it to a folderitem
I have tried

f=GetFolderItem(s,FolderItem.PathTypeShell) // NativePath
// shell path gives me an "unsupported error - must be absolute
// native gives me file does not exist, when I know for a fact it does

Please don’t suggest “SpecialFolder.Desktop” etc… the string above is just a test, the real data will be coming from external sources

I am sure I’m staring at this and missing the Elephant in the room

This is absolutePath that uses colon as separator. NativePath and ShellPath are posix paths that use / as separator.

Maybe a ReplaceAll is in order ?

f=GetFolderItem(s,FolderItem.PathTypeAbsolute)

This gets tricky on Linux, where it is legal to have a colon in a filename. A ReplaceAll will break your filename.

#If Target…

It looks terribly difficult if not impossible to parse such a thing as

dim s as string s="Macintosh HD:Users:daveS:Desktop:my:file.txt"

Maybe getting parent until one reaches a valid folder and then assume my and file.txt are in fact one single file with a colon inside the name.

At any rate that shows how pertinent Posix path is.

Save the file path using .URLPath,
Construct the FolderItem using FolderItem.PathTypeURL

Seems to works here.

I finally was able to test my above suggestion (in fact load the file) and this is OK.

The passed .URLPath (contents) is loaded.