On 19/05/2018 at 21:38, xxxxxxxx wrote:
User Information:
Cinema 4D Version: R19
Platform: Windows ;
Language(s) : C++ ;
---------
Hi,
I am trying to parse a folder for C4D scene files, checking on the suffix of files being equal to "c4d".
This works fine on Windows systems, but I am not sure the same will work on MacOS as I remember from pre-OSX times that no actual filename extensions were used.
Instead I looked at a more generic solution and found the GeIdentifyFile function in the SDK, however I am not getting any valid results from using it, as it always returns IDENTIFYFILE_0. Which, according the documentation, means the identification failed.
Following is part of the implementation I used:
AutoAlloc<BrowseFiles> fileBrowser;
if (!fileBrowser)
return FALSE;
Filename path = GetPath(); // custom method
fileBrowser->Init(path, BROWSEFILES_SUPPRESSCACHING | BROWSEFILES_CALCSIZE);
Int32 probeSize = 1024;
UChar* probe = NewMemClear(UChar, probeSize);
while (fileBrowser->GetNext())
{
Filename fn = fileBrowser->GetFilename();
IDENTIFYFILE idf = GeIdentifyFile(fn, probe, probeSize, IDENTIFYFILE_SCENE, nullptr);
GePrint("File " + fn.GetString() + " = " + String::IntToString(idf));