I am getting back with an annoying situation. I have the open file name and path within a AVAppEnumDocs() callback function.
PDDoc pdDoc = AVDocGetPDDoc(doc);
ASFile fileinfo = PDDocGetFile(pdDoc);
ASFileSys fileSys = ASFileGetFileSys(fileinfo);
ASPathName pathname = ASFileAcquirePathName(fileinfo);
ustring sFilePath; sFilePath = static_cast(ASFileSysDisplayStringFromPath(fileSys, pathname));
where
#ifdef _UNICODE
#define ustring std::wstring
#else #define ustring std::string
#endif
Everything runs perfect within a non-unicode plugin and I get the file path for most of the files I have opened. If I open a so called "Kjøp og selg skiutstyr på Torge.pdf" file with no connection to Acrobat.com cloud everything is fine. But in the moment I open the same file that was uploaded to Acrobat.com cloud and I try to get it's name I get a spoiled file name "Kjøp og selg skiutstyr pÃ¥ Torge.pdf" into sFilePath.
I was trying to use ASTextGetUnicode() bot the things became even worse!
ASText pathText = ASTextNew();
ASFileSysDisplayASTextFromPath(ASGetDefaultFileSys(), pathname, pathText);
wchar_t *sFilePath = (wchar_t*)ASTextGetUnicode(pathText);
But I get a "Chinese’s" chars string instead of the proper file name. The Acrobat application shows correctly the file name. If i replace wchar_t with char_t for the last line ASTextGetUnicode() provides me only "C".
How can I get the correct filename and path in any condition? I am looking for a proper way to get this path and push it into a std::vector<ustring>.