!B (Sandbox) (CE-21795) Importing models with multisubmaterials via fbx switches...
[CRYENGINE.git] / Code / Sandbox / Plugins / SchematycEditor / Util.cpp
blob3daa03f65a2855efecbee22718c0c7c0e376c27c
1 // Copyright 2001-2016 Crytek GmbH / Crytek Group. All rights reserved.
3 #include "StdAfx.h"
4 #include "Util.h"
6 namespace Cry {
8 namespace SchematycEd {
10 //////////////////////////////////////////////////////////////////////////
11 void GetSubFoldersAndFileNames(const char* szFolderName, const char* szExtension, bool bIgnorePakFiles, TStringVector& subFolderNames, TStringVector& fileNames)
13 CRY_ASSERT(szFolderName);
14 if (szFolderName)
16 string searchPath = szFolderName;
17 searchPath.append("/");
18 searchPath.append(szExtension ? szExtension : "*.*");
19 _finddata_t findData;
20 intptr_t handle = gEnv->pCryPak->FindFirst(searchPath.c_str(), &findData);
21 if (handle >= 0)
25 if (findData.name[0] != '.')
27 if (findData.attrib & _A_SUBDIR)
29 bool bIgnoreSubDir = false;
30 if (bIgnorePakFiles)
32 stack_string fileName = gEnv->pCryPak->GetGameFolder();
33 fileName.append("/");
34 fileName.append(szFolderName);
35 fileName.append("/");
36 fileName.append(findData.name);
37 if (GetFileAttributes(fileName.c_str()) == INVALID_FILE_ATTRIBUTES)
39 bIgnoreSubDir = true;
42 if (!bIgnoreSubDir)
44 subFolderNames.push_back(findData.name);
47 else if (!bIgnorePakFiles || ((findData.attrib & _A_IN_CRYPAK) == 0))
49 fileNames.push_back(findData.name);
52 } while (gEnv->pCryPak->FindNext(handle, &findData) >= 0);
57 } // namespace SchematycEd
59 } // namespace Cry