зеркало из https://github.com/mozilla/gecko-dev.git
Fixed GetParent() on windows and unix (was incorrect for directories whose paths end in a separator).
This commit is contained in:
Родитель
99ecfeb9bb
Коммит
7910e844e2
|
@ -178,6 +178,7 @@ void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
|||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
outSpec.mPath = mPath;
|
||||
outSpec.mPath[outSpec.mPath.Length() - 1] = '\0'; // avoid trailing separator, if any
|
||||
char* cp = strrchr(outSpec.mPath, '/');
|
||||
if (cp++)
|
||||
*cp = '\0';
|
||||
|
|
|
@ -222,6 +222,7 @@ void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
|||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
outSpec.mPath = mPath;
|
||||
outSpec.mPath[outSpec.mPath.Length() - 1] = '\0';; // avoid trailing separator, if any
|
||||
char* cp = strrchr(outSpec.mPath, '\\');
|
||||
if (cp++)
|
||||
*cp = '\0';
|
||||
|
|
|
@ -178,6 +178,7 @@ void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
|||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
outSpec.mPath = mPath;
|
||||
outSpec.mPath[outSpec.mPath.Length() - 1] = '\0'; // avoid trailing separator, if any
|
||||
char* cp = strrchr(outSpec.mPath, '/');
|
||||
if (cp++)
|
||||
*cp = '\0';
|
||||
|
|
|
@ -222,6 +222,7 @@ void nsFileSpec::GetParent(nsFileSpec& outSpec) const
|
|||
//----------------------------------------------------------------------------------------
|
||||
{
|
||||
outSpec.mPath = mPath;
|
||||
outSpec.mPath[outSpec.mPath.Length() - 1] = '\0';; // avoid trailing separator, if any
|
||||
char* cp = strrchr(outSpec.mPath, '\\');
|
||||
if (cp++)
|
||||
*cp = '\0';
|
||||
|
|
Загрузка…
Ссылка в новой задаче