Archicad C++ API
About Archicad add-on development using the C++ API.

No member named 'ToCFURL' in 'IO::Location' in AC23

Anonymous
Not applicable
Hello,

Code below compiled successfully in AC22, but providing error in AC23. "No member named 'ToCFURL' in 'IO::Location' "

#if CF_DevKit_Version >= 17
#ifdef macintosh
void CF_Location::ToCFURLRef (CFURLRef& cfUrlRef) const {

CIO::Location cioloc (fLoc);
cioloc.ToCFURL (&cfUrlRef);

} // CF_Location::ToCFURLRef
#endif // macintosh
#endif // CF_DevKit_Version >= 17

No member named 'ToUTF8POSIXPath' in 'IO::Location'

#ifdef macintosh
CF_String CF_Location::GetPOSIXPath () const {

CIO::Location cioloc (fLoc.ToGSUniString ());
CIO::Path cioPath;

#if CF_DevKit_Version < 15
GSErrCode err = cioloc.ToPOSIXPath (&cioPath);
#else
GSErrCode err = cioloc.ToUTF8POSIXPath (&cioPath);
#endif // CF_DevKit_Version < 15

if (err != NoError) return CF_String ();
return CF_String (cioPath);

} // CF_Location::GetPOSIXPath
#endif // macintosh

Is there any new function in AC23 instead of ToUTF8POSIXPath and ToCFURL?
Regards,
2 REPLIES 2
Anonymous
Not applicable
New version of Modules/InputOutput/Location.hpp miss code below.

#if defined (macintosh)
#ifdef INPUTOUTPUT_MODULE_PRIVATE
GSErrCode ToFSRef (FSRef* result) const; // DOC
#endif
GSErrCode ToCFURL (CFURLRef* result) const; // DOC
GSErrCode ToUTF8POSIXPath (Path* result) const; // DOC
#endif

How should I rewrite my code to be compatible with the new version?
Akos Somorjai
Graphisoft
Graphisoft
Hi,

ToUTF8POSIXPath () is simply ToPath().ToCStr(). Get(), as all C strings are UTF-8 encoded.

From this path you can create a CFURLRef with CFURLCreateFromFileSystemRepresentation (see https://developer.apple.com/documentation/corefoundation/1543314-cfurlcreatefromfilesystemreprese?la...)

Best, Akos