MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / setDefaultPath

Method setDefaultPath

Engine/source/platform/nativeDialogs/fileDialog.cpp:416–447  ·  view source on GitHub ↗

----------------------------------------------------------------------------- Default Path Property - String Validated on Write -----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

414// Default Path Property - String Validated on Write
415//-----------------------------------------------------------------------------
416bool FileDialog::setDefaultPath(void *object, const char *index, const char *data)
417{
418 if (!data || !dStrncmp(data, "", 1))
419 return true;
420
421 // Copy and Backslash the path (Windows dialogs are VERY picky about this format)
422 static char szPathValidate[512];
423 dStrcpy(szPathValidate, data);
424
425 Platform::makeFullPathName(data, szPathValidate, sizeof(szPathValidate));
426 //backslash( szPathValidate );
427
428 // Remove any trailing \'s
429 S8 validateLen = dStrlen(szPathValidate);
430 if (szPathValidate[validateLen - 1] == '\\')
431 szPathValidate[validateLen - 1] = '\0';
432
433 // Now check
434 if (Platform::isDirectory(szPathValidate))
435 {
436 // Finally, assign in proper format.
437 FileDialog *pDlg = static_cast<FileDialog*>(object);
438 pDlg->mData.mDefaultPath = StringTable->insert(szPathValidate);
439 }
440#ifdef TORQUE_DEBUG
441 else
442 Con::errorf(ConsoleLogEntry::GUI, "FileDialog - Invalid Default Path Specified!");
443#endif
444
445 return false;
446
447};
448
449//-----------------------------------------------------------------------------
450// Default File Property - String Validated on Write

Callers

nothing calls this directly

Calls 4

dStrncmpFunction · 0.85
dStrcpyFunction · 0.85
dStrlenFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected