- Api nsILocalFile::AppendRelativePath() added to interface

- nsILocalFile::Append() returns error uniformly on all platforms if
more than one component of path is being appended.


git-svn-id: svn://10.0.0.236/trunk@68351 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
dp%netscape.com
2000-05-05 05:47:32 +00:00
parent 9e6c72d5c4
commit 09f87e1345
5 changed files with 63 additions and 6 deletions

View File

@@ -417,6 +417,28 @@ nsLocalFile::Append(const char *fragment)
{
NS_ENSURE_ARG(fragment);
CHECK_mPath();
// only one component of path can be appended
if (strstr(fragment, "/") != nsnull)
{
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
}
return AppendRelativePath(fragment);
}
NS_IMETHODIMP
nsLocalFile::AppendRelativePath(const char *fragment)
{
NS_ENSURE_ARG(fragment);
CHECK_mPath();
// Cannot start with a '/' and no .. allowed in the fragment
if ((*fragment == '/') || (strstr(fragment, "..") != nsnull))
{
return NS_ERROR_FILE_UNRECOGNIZED_PATH;
}
char * newPath = (char *)nsAllocator::Alloc(strlen(mPath) +
strlen(fragment) + 2);
if (!newPath)