given a base folderitem (the starting point)
and a relative path this will return the folderitm that is at the relative location from the starting point
it has nothing to do with getting a relative path as a string
This is incredibly barbaric and will not work in reverse (if the base is deeper than the child) but should get you started on what you’re looking to try to get:
[code]Public Function NativePathRelativeTo(extends fBase as FolderItem, fChild as FolderItem) as String
if fBase = nil or fChild = nil then return “”
dim sBasePath as String = fBase.Parent.NativePath
dim sChildPath as String = fChild.NativePath
return sChildPath.Replace(sBasePath, “”)
End Function
[/code]
[quote=338778:@Mathias Maes]Thanks Tim, I figured something out amost the same way you did
Altough the naming in Xojo is still wrong imho.
a GetRelative function should get a relative.
The functions should be renamed to FromRelative[/quote]
Unfortunately it can’t be renamed without potentially breaking existing code because this method has been around for so long and we really try to avoid that.
Yeah, I totally get that.
Thanks for your answer Greg! Keep up the great work at Xojo! My ‘complaint’ wasn’t really a rant or something. More like a hint, because it can be confusing for newcomers (like I’m still am sometimes).
[quote=338787:@Mathias Maes]Yeah, I totally get that.
Thanks for your answer Greg! Keep up the great work at Xojo! My ‘complaint’ wasn’t really a rant or something. More like a hint, because it can be confusing for newcomers (like I’m still am sometimes).[/quote]
You could still file a feature request for the new framework. One of the things we’re trying to do is resolve naming issues like this.