How to convert a new framework folderitem to an old framework folderitem?

Is there an easy way to convert a folderitem from the new framework into a folderitem that works with the old framework?

Since SpecialFolder.Resources isn’t implemented (why not?), I want to use folderitem.GetResource in the new framework to get a path to a file I want to process with code written for the old framework.

I don’t see folderitem.GetSaveInfo in the new framework, so is using a Path to convert between the two the best approach?

Use the Path property with GetFolderItem as a NativePath.

Hi Greg

Thanks for the quick reply. I’ll give that a try… I’m always hesitant to use paths in crossplatform code, but since this code is always local to one platform at a time it should be OK, I hope. :slight_smile:

I use this extension method:

[code]Public Function ToModernFolderItem(Extends f as FolderItem) as xojo.IO.FolderItem
’ Converts a classic framework FolderItem to the new framework.

If f = Nil Then Return Nil

Return New Xojo.IO.FolderItem(f.NativePath.ToText)
End Function
[/code]
Stick it in a module and then call it like this:

' Assume oldF is a classic framework FolderItem Dim newF as Xojo.IO.FolderItem = oldF.ToModernFolderItem

Hope that helps.