REALFolderItemFromParentFSRef without parent?


how to use REALFolderItemFromParentFSRef with FSRef for root of volume?

For 32bit I long had a fallback to use FSSpec for that, but that is not available in 64bit.

I tried calling REALFolderItemFromParentFSRef with nil for name, but that gives a failed assertion:

Assertion failed: (unistr, “”), function ConstructFromHFSUniStr255, file Universal/REALstring.cpp, line 309.

Now calling it with an empty name string seems to work, but I’d like to know if that is correct.

You should move away from this function and use REALGetPropValueString to get the FolderItem’s URLPath.


This is for FSRef -> FolderItem.

[quote=247460:@Christian Schmitz]What?

This is for FSRef → FolderItem.[/quote]

Ah sorry, I misread.

It’s not and it’ll give you a FolderItem that behaves differently than one acquired through a function like Volume. I would recommend using REALnewInstanceWithClass and REALLoadObjectMethod to create a FolderItem instance and invoke its constructor.

Okay. I think I just get a native path and ask GetTrueFolderItem for a folderitem.