mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-12 07:04:36 +00:00
Add static String::isEmpty(const char*) method and use it to verify path for Forest::saveDataFile() is not empty.
This commit is contained in:
parent
b3170bcddf
commit
3ddd9b8a4c
3 changed files with 7 additions and 1 deletions
|
|
@ -657,6 +657,11 @@ bool String::isEmpty() const
|
||||||
return ( _string == StringData::Empty() );
|
return ( _string == StringData::Empty() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool String::isEmpty(const char* str)
|
||||||
|
{
|
||||||
|
return (dStrlen(str) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
bool String::isShared() const
|
bool String::isShared() const
|
||||||
{
|
{
|
||||||
return _string->isShared();
|
return _string->isShared();
|
||||||
|
|
|
||||||
|
|
@ -74,6 +74,7 @@ public:
|
||||||
SizeType size() const; ///< Returns the length of the string in bytes including the NULL terminator.
|
SizeType size() const; ///< Returns the length of the string in bytes including the NULL terminator.
|
||||||
SizeType numChars() const; ///< Returns the length of the string in characters.
|
SizeType numChars() const; ///< Returns the length of the string in characters.
|
||||||
bool isEmpty() const; ///< Is this an empty string [""]?
|
bool isEmpty() const; ///< Is this an empty string [""]?
|
||||||
|
static bool isEmpty(const char*); // is the input empty?
|
||||||
bool isNotEmpty() const { return !isEmpty(); } ///< Is this not an empty string [""]?
|
bool isNotEmpty() const { return !isEmpty(); } ///< Is this not an empty string [""]?
|
||||||
|
|
||||||
/// Erases all characters in a string.
|
/// Erases all characters in a string.
|
||||||
|
|
|
||||||
|
|
@ -354,7 +354,7 @@ void Forest::createNewFile()
|
||||||
|
|
||||||
void Forest::saveDataFile( const char *path )
|
void Forest::saveDataFile( const char *path )
|
||||||
{
|
{
|
||||||
if ( path )
|
if ( path && !String::isEmpty(path))
|
||||||
mDataFileName = StringTable->insert( path );
|
mDataFileName = StringTable->insert( path );
|
||||||
|
|
||||||
if ( mData )
|
if ( mData )
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue