I recently spent a lot of time tracking down an issue using GetFolderItem
I know that it is ‘deprecated’ (although it doesnt seem to have a good replacement - the documented folderitem constructor doesnt seem to accept a path?)
But bear with me… lots of people are using older Xojo versions, and my problem occurred because I code in in 2018R3 but have begun compiling in newer versions to get a Universal build for Mac
In Xojo 2018 (and 2015 which I use on Windows), this code will get me a valid folderitem
dim f as folderitem = <some valid and existant folderitem>
dim s as string = f.absolutepath
dim f2 as folderitem = getfolderitem(s)
I started hearing of issues when the folderitem in question was on an external drive, and convinced myself that was the problem.
The absolutepath might be EXT1:Somefile.jpg
In Xojo 2018 onwards, what happens is this:
dim f as folderitem = {some valid and existant folderitem}
dim s as string = f.absolutepath
dim f2 as folderitem = getfolderitem(s)
//f2.exists is now FALSE
//F2.absolutepath looks like this...
//{Full Path to Applications Folder}/EXT1\Somefile.jpg
Now in some respects, this will be explainable - because the doc for
GetFolderItem says it defaults to ‘current folder’ (which would be applications)
In Xojo 2018, the string is recognised as containing a volume name, and it works.
In Xojo 2021, the string is taken as ‘generic’ and appended to the local folder path.
This behavior shouldnt have changed, regardless of deprecation, but I guess no-one will consider it as a bug that will be addressed.
I have the usual workaround: the MBS plugins provide a function called
NewFolderItemFromAbsolutePathMBS
which works as I expect it to.