MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / addPathToTree

Method addPathToTree

Engine/source/gui/controls/guiFileTreeCtrl.cpp:189–223  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

187}
188
189void GuiFileTreeCtrl::addPathToTree( StringTableEntry path )
190{
191 if( !path )
192 {
193 Con::errorf("GuiFileTreeCtrl::addPathToTree - Invalid Path!");
194 return;
195 }
196
197 // Identify which root (volume) this path belongs to (if any)
198 S32 root = getFirstRootItem();
199 StringTableEntry ourPath = &path[ dStrcspn( path, "/" ) + 1];
200 StringTableEntry ourRoot = StringUnit::getUnit( path, 0, "/" );
201 // There are no current roots, we can safely create one
202 if( root == 0 )
203 {
204 recurseInsert( NULL, path );
205 }
206 else
207 {
208 while( root != 0 )
209 {
210 if( dStricmp( getItemValue( root ), ourRoot ) == 0 )
211 {
212 recurseInsert( getItem( root ), ourPath );
213 break;
214 }
215 root = this->getNextSiblingItem( root );
216 }
217 // We found none so we'll create one
218 if ( root == 0 )
219 {
220 recurseInsert( NULL, path );
221 }
222 }
223}
224
225void GuiFileTreeCtrl::onItemSelected( Item *item )
226{

Callers

nothing calls this directly

Calls 5

dStrcspnFunction · 0.85
getUnitFunction · 0.85
dStricmpFunction · 0.85
getNextSiblingItemMethod · 0.80
errorfFunction · 0.50

Tested by

no test coverage detected