I have the same problem. The manual or documentation somewhere says that AEGP_GetProjectPath only returns valid data after recently saving the project. Usually I get NULL for a response so I moved on.
1 person found this helpful
I'm coming in a bit late on this one... but it's worth noting that wchar_t is 16-bit on Win, but 32-bit on MacOS. So A_UTF16Char and wchar_t are not interchangable on MacOS. Search for the sample code copyConvertStringLiteralIntoUTF16() in the SDK for a not-so-pretty example of how to handle this.
There are two two issues here:
Mac uses UTF-8 and Windows needs UTF-16. After Effects gives UTF-16 but it is easy to convert for Mac plug-ins. This is not a problem. We are used to that. wchar_t is an issue on the Mac so I aviod wchar_t and stick with UTF-16.
The real problem is that we do not get the GetProjectPath() in AE until rendering. That means we have no idea of that until too late. GetProjectPath() returns NULL.
True, it does sound like we're talking about two different issues here. Although I replied to your post, my feedback was based on PSuuraho's code in the original post.
Hey all, I am also trying to get a std string from the pointer to pathText provided by:
A_UTF16Char *pathText = NULL; err = suites.MemorySuite1()->AEGP_LockMemHandle(pathH, (void**)&pathText);
I'm having a lot of trouble converting it correctly on both Mac and Win.
Does anyone have any code that does this? Essentially take pathText above and create a std string?