Convert POSIX path to Shell path

I receive an excel file of data from a client, and in this data is a file path which is in POSIX format. I need to use this path to replicate their folder structure, but I can’t use the path in the shell as it is provided. Certain characters are escaped (space, hyphen) within the ShellPath, otherwise the path formats are similar. I can do a ReplaceAll on the POSIX path:

folderPath = folderPath.ReplaceAll(" ", "\\ ") folderPath = folderPath.ReplaceAll("-", "\\-")

… but I’m not sure if there are any other characters I would need to escape, and I’d prefer if there’s a more proper way to do so.

Is there a built-in way to do this conversion? I have MacOSLib included within this project, which allows me to get the POSIX Path of a FolderItem, but not to convert it to a ShellPath, and I don’t believe there’s a way to use it to specify the path is a POSIX path for the FolderItem Constructor.

Alternately, if I have to ‘roll my own’, are there any other characters which I need to escape?

NativePath is a Posix Path according to the LR.

ShellPath is an escaped Posix path.

Chances are if you feed the path to a GetFolderItem, PathTypeShell it will work just fine.

Just use the FolderItem class to convert it:

dim myShellPath as string
dim myFile as FolderItem = GetFolderItem(myNativePath, FolderItem.PathTypeNative)
if myFile isA FolderItem then
    myShellPath = myFile.ShellPath
end if

[quote=286067:@Michel Bujardet]NativePath is a Posix Path according to the LR.

ShellPath is an escaped Posix path.

Chances are if you feed the path to a GetFolderItem, PathTypeShell it will work just fine.[/quote]
You’re right, PathTypeShell does seem to work. And, I totally missed NativePath, which is also correct.

Thanks Michel and Massimo.