1999-05-26 05:38:36 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1999-05-26 05:38:36 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
* rights and limitations under the License.
|
1999-05-26 05:38:36 +04:00
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1999-05-26 05:38:36 +04:00
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:43:54 +03:00
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
* Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
1999-12-01 02:36:32 +03:00
|
|
|
* Pierre Phaneuf <pp@ludusdesign.com>
|
1999-05-26 05:38:36 +04:00
|
|
|
*/
|
|
|
|
|
1999-05-29 05:28:25 +04:00
|
|
|
#include "nsFileSpecImpl.h"// Always first, to ensure that it compiles alone.
|
|
|
|
|
1999-05-26 05:38:36 +04:00
|
|
|
#include "nsIFileStream.h"
|
|
|
|
#include "nsFileStream.h"
|
|
|
|
|
|
|
|
#include "prmem.h"
|
|
|
|
|
1999-08-23 14:14:16 +04:00
|
|
|
NS_IMPL_ISUPPORTS1(nsFileSpecImpl, nsIFileSpec)
|
1999-05-29 05:28:25 +04:00
|
|
|
|
1999-05-26 05:38:36 +04:00
|
|
|
#ifdef NS_DEBUG
|
|
|
|
#define TEST_OUT_PTR(p) \
|
|
|
|
if (!(p)) \
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
#else
|
|
|
|
#define TEST_OUT_PTR(p)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
nsFileSpecImpl::nsFileSpecImpl()
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
: mInputStream(nsnull)
|
|
|
|
, mOutputStream(nsnull)
|
|
|
|
{
|
|
|
|
NS_INIT_ISUPPORTS();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
nsFileSpecImpl::nsFileSpecImpl(const nsFileSpec& inSpec)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
: mFileSpec(inSpec)
|
|
|
|
, mInputStream(nsnull)
|
|
|
|
, mOutputStream(nsnull)
|
|
|
|
{
|
|
|
|
NS_INIT_ISUPPORTS();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
nsFileSpecImpl::~nsFileSpecImpl()
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
1999-08-25 09:26:25 +04:00
|
|
|
CloseStream();
|
1999-05-26 05:38:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
/* static */
|
|
|
|
nsresult nsFileSpecImpl::MakeInterface(const nsFileSpec& inSpec, nsIFileSpec** result)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
nsFileSpecImpl* it = new nsFileSpecImpl(inSpec);
|
|
|
|
if (!it)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
1999-12-01 02:36:32 +03:00
|
|
|
return it->QueryInterface(NS_GET_IID(nsIFileSpec), (void **) result);
|
1999-05-26 05:38:36 +04:00
|
|
|
} // nsFileSpecImpl::MakeInterface
|
|
|
|
|
|
|
|
#define FILESPEC(ifilespec) ((nsFileSpecImpl*)ifilespec)->mFileSpec
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::FromFileSpec(const nsIFileSpec *original)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec = FILESPEC(original);
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-09-04 03:44:59 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::IsChildOf(nsIFileSpec *possibleParent,
|
|
|
|
PRBool *_retval)
|
|
|
|
{
|
|
|
|
*_retval = mFileSpec.IsChildOf(FILESPEC(possibleParent));
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-05-26 05:38:36 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetURLString(char * *aURLString)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aURLString)
|
|
|
|
if (mFileSpec.Failed())
|
|
|
|
return mFileSpec.Error();
|
|
|
|
nsFileURL url(mFileSpec);
|
|
|
|
*aURLString = nsCRT::strdup(url.GetURLString());
|
|
|
|
if (!*aURLString)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
return NS_OK;
|
|
|
|
} // nsFileSpecImpl::GetURLString
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-09-20 03:46:35 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::SetURLString(const char * aURLString)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec = nsFileURL(aURLString);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetUnixStyleFilePath(char * *aUnixStyleFilePath)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aUnixStyleFilePath)
|
|
|
|
if (mFileSpec.Failed())
|
|
|
|
return mFileSpec.Error();
|
|
|
|
nsFilePath path(mFileSpec);
|
|
|
|
*aUnixStyleFilePath = nsCRT::strdup((const char*) path);
|
|
|
|
if (!*aUnixStyleFilePath)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-09-20 03:46:35 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::SetUnixStyleFilePath(const char * aUnixStyleFilePath)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec = nsFilePath(aUnixStyleFilePath);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetPersistentDescriptorString(char * *aPersistentDescriptorString)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aPersistentDescriptorString)
|
|
|
|
if (mFileSpec.Failed())
|
|
|
|
return mFileSpec.Error();
|
|
|
|
nsPersistentFileDescriptor desc(mFileSpec);
|
|
|
|
nsSimpleCharString data;
|
|
|
|
desc.GetData(data);
|
|
|
|
*aPersistentDescriptorString = nsCRT::strdup((const char*) data);
|
|
|
|
if (!*aPersistentDescriptorString)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-09-20 03:46:35 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::SetPersistentDescriptorString(const char * aPersistentDescriptorString)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
nsPersistentFileDescriptor desc(mFileSpec);
|
|
|
|
desc.SetData(aPersistentDescriptorString);
|
|
|
|
mFileSpec = desc;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetNativePath(char * *aNativePath)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aNativePath)
|
|
|
|
if (mFileSpec.Failed())
|
|
|
|
return mFileSpec.Error();
|
|
|
|
*aNativePath = nsCRT::strdup(mFileSpec.GetNativePathCString());
|
|
|
|
if (!*aNativePath)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-09-20 03:46:35 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::SetNativePath(const char * aNativePath)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec = aNativePath;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetNSPRPath(char * *aNSPRPath)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aNSPRPath)
|
|
|
|
if (mFileSpec.Failed())
|
|
|
|
return mFileSpec.Error();
|
|
|
|
nsNSPRPath path(mFileSpec);
|
|
|
|
*aNSPRPath = nsCRT::strdup((const char*) path);
|
|
|
|
if (!*aNSPRPath)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Error()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::IsValid(PRBool *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
*_retval = mFileSpec.Valid();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Failed(PRBool *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
*_retval = mFileSpec.Failed();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetLeafName(char * *aLeafName)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aLeafName)
|
|
|
|
*aLeafName = mFileSpec.GetLeafName();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-09-20 03:46:35 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::SetLeafName(const char * aLeafName)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec.SetLeafName(aLeafName);
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetParent(nsIFileSpec * *aParent)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aParent)
|
|
|
|
nsFileSpec parent;
|
|
|
|
mFileSpec.GetParent(parent);
|
|
|
|
return MakeInterface(parent, aParent);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::MakeUnique()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec.MakeUnique();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::MakeUniqueWithSuggestedName(const char *suggestedName)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec.MakeUnique(suggestedName);
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetModDate(PRUint32 *aModDate)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aModDate)
|
|
|
|
nsFileSpec::TimeStamp stamp;
|
|
|
|
mFileSpec.GetModDate(stamp);
|
|
|
|
*aModDate = stamp;
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::ModDateChanged(PRUint32 oldStamp, PRBool *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
*_retval = mFileSpec.ModDateChanged(oldStamp);
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::IsDirectory(PRBool *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
*_retval = mFileSpec.IsDirectory();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::IsFile(PRBool *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
*_retval = mFileSpec.IsFile();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Exists(PRBool *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
*_retval = mFileSpec.Exists();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
1999-07-21 21:56:01 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::IsHidden(PRBool *_retval)
|
1999-07-21 21:56:01 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
*_retval = mFileSpec.IsHidden();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
1999-07-27 02:09:42 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::IsSymlink(PRBool *_retval)
|
1999-07-27 02:09:42 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
*_retval = mFileSpec.IsSymlink();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::ResolveSymlink()
|
1999-07-27 02:09:42 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
PRBool ignore;
|
|
|
|
return mFileSpec.ResolveSymlink(ignore);
|
|
|
|
}
|
|
|
|
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetFileSize(PRUint32 *aFileSize)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aFileSize)
|
|
|
|
*aFileSize = mFileSpec.GetFileSize();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-09-11 00:03:56 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetDiskSpaceAvailable(PRInt64 *aDiskSpaceAvailable)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aDiskSpaceAvailable)
|
|
|
|
*aDiskSpaceAvailable = mFileSpec.GetDiskSpaceAvailable();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::AppendRelativeUnixPath(const char *relativePath)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec += relativePath;
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
1999-07-13 23:10:43 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Touch()
|
1999-07-13 23:10:43 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
// create an empty file, like the UNIX touch command.
|
|
|
|
nsresult rv;
|
1999-08-25 09:26:25 +04:00
|
|
|
rv = OpenStreamForReadingAndWriting();
|
1999-07-13 23:10:43 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-08-25 09:26:25 +04:00
|
|
|
rv = CloseStream();
|
1999-07-13 23:10:43 +04:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::CreateDir()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec.CreateDir();
|
|
|
|
return mFileSpec.Error();
|
|
|
|
}
|
|
|
|
|
1999-11-19 04:42:46 +03:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Truncate(PRInt32 aNewLength)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
return mFileSpec.Truncate(aNewLength);
|
|
|
|
}
|
|
|
|
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Rename(const char *newLeafName)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
return mFileSpec.Rename(newLeafName);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::CopyToDir(const nsIFileSpec *newParentDir)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
1999-10-21 04:40:39 +04:00
|
|
|
return mFileSpec.CopyToDir(FILESPEC(newParentDir));
|
1999-05-26 05:38:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::MoveToDir(const nsIFileSpec *newParentDir)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
1999-10-21 04:40:39 +04:00
|
|
|
return mFileSpec.MoveToDir(FILESPEC(newParentDir));
|
1999-05-26 05:38:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Execute(const char *args)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
return mFileSpec.Execute(args);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::OpenStreamForReading()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
if (mInputStream || mOutputStream)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
return NS_NewTypicalInputFileStream((nsISupports**)&mInputStream, mFileSpec);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::OpenStreamForWriting()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
if (mInputStream || mOutputStream)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
return NS_NewTypicalOutputFileStream((nsISupports**)&mOutputStream, mFileSpec);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::OpenStreamForReadingAndWriting()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
if (mInputStream || mOutputStream)
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
nsresult result = NS_NewTypicalInputFileStream((nsISupports**)&mInputStream, mFileSpec);
|
|
|
|
if (NS_SUCCEEDED(result))
|
|
|
|
result = NS_NewTypicalOutputFileStream((nsISupports**)&mOutputStream, mFileSpec);
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::CloseStream()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
NS_IF_RELEASE(mInputStream);
|
|
|
|
NS_IF_RELEASE(mOutputStream);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::IsStreamOpen(PRBool *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
*_retval = (mInputStream || mOutputStream);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-06-15 02:05:41 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetInputStream(nsIInputStream** _retval)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
1999-07-02 10:31:31 +04:00
|
|
|
if (!mInputStream) {
|
1999-08-25 09:26:25 +04:00
|
|
|
nsresult rv = OpenStreamForReading();
|
1999-07-02 10:31:31 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
}
|
1999-06-15 02:05:41 +04:00
|
|
|
*_retval = mInputStream;
|
|
|
|
NS_IF_ADDREF(mInputStream);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetOutputStream(nsIOutputStream** _retval)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
1999-07-02 10:31:31 +04:00
|
|
|
if (!mOutputStream) {
|
1999-08-25 09:26:25 +04:00
|
|
|
nsresult rv = OpenStreamForWriting();
|
1999-07-02 10:31:31 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
}
|
1999-06-15 02:05:41 +04:00
|
|
|
*_retval = mOutputStream;
|
|
|
|
NS_IF_ADDREF(mOutputStream);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-09-20 03:46:35 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::SetFileContents(const char* inString)
|
1999-06-15 02:05:41 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
1999-08-25 09:26:25 +04:00
|
|
|
nsresult rv = OpenStreamForWriting();
|
1999-07-02 10:31:31 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-15 02:05:41 +04:00
|
|
|
PRInt32 count;
|
1999-08-25 09:26:25 +04:00
|
|
|
rv = Write(inString, PL_strlen(inString), &count);
|
|
|
|
nsresult rv2 = CloseStream();
|
1999-06-15 02:05:41 +04:00
|
|
|
return NS_FAILED(rv) ? rv : rv2;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetFileContents(char** _retval)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
*_retval = nsnull;
|
1999-08-25 09:26:25 +04:00
|
|
|
nsresult rv = OpenStreamForReading();
|
1999-07-02 10:31:31 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
1999-06-15 02:05:41 +04:00
|
|
|
PRInt32 theSize;
|
|
|
|
rv = GetFileSize((PRUint32*)&theSize);
|
|
|
|
if (NS_SUCCEEDED(rv))
|
1999-08-25 09:26:25 +04:00
|
|
|
rv = Read(_retval, theSize, &theSize);
|
1999-06-15 02:05:41 +04:00
|
|
|
if (NS_SUCCEEDED(rv))
|
|
|
|
(*_retval)[theSize] = 0;
|
1999-08-25 09:26:25 +04:00
|
|
|
nsresult rv2 = CloseStream();
|
1999-06-15 02:05:41 +04:00
|
|
|
return NS_FAILED(rv) ? rv : rv2;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::GetFileSpec(nsFileSpec *aFileSpec)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(aFileSpec)
|
|
|
|
*aFileSpec = mFileSpec;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-11-13 05:02:22 +03:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Equals(nsIFileSpec *spec, PRBool *result)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
nsresult rv;
|
|
|
|
|
|
|
|
if (!result || !spec) return NS_ERROR_NULL_POINTER;
|
|
|
|
|
|
|
|
nsFileSpec otherSpec;
|
|
|
|
|
|
|
|
rv = spec->GetFileSpec(&otherSpec);
|
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
|
|
|
|
if (mFileSpec == otherSpec) {
|
|
|
|
*result = PR_TRUE;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
*result = PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-06-22 09:03:30 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::SetFromFileSpec(const nsFileSpec& aFileSpec)
|
1999-06-22 09:03:30 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
mFileSpec = aFileSpec;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Eof(PRBool *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
if (!mInputStream)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
nsInputFileStream s(mInputStream);
|
|
|
|
*_retval = s.eof();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Read(char** buffer, PRInt32 requestedCount, PRInt32 *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
TEST_OUT_PTR(buffer)
|
1999-07-02 10:31:31 +04:00
|
|
|
if (!mInputStream) {
|
1999-08-25 09:26:25 +04:00
|
|
|
nsresult rv = OpenStreamForReading();
|
1999-07-02 10:31:31 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
}
|
1999-05-26 05:38:36 +04:00
|
|
|
if (!*buffer)
|
|
|
|
*buffer = (char*)PR_Malloc(requestedCount + 1);
|
|
|
|
if (!mInputStream)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
nsInputFileStream s(mInputStream);
|
|
|
|
*_retval = s.read(*buffer, requestedCount);
|
|
|
|
return s.error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::ReadLine(char** line, PRInt32 bufferSize, PRBool *wasTruncated)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(wasTruncated)
|
|
|
|
TEST_OUT_PTR(line)
|
1999-07-02 10:31:31 +04:00
|
|
|
if (!mInputStream) {
|
1999-08-25 09:26:25 +04:00
|
|
|
nsresult rv = OpenStreamForReading();
|
1999-07-02 10:31:31 +04:00
|
|
|
if (NS_FAILED(rv)) return rv;
|
|
|
|
}
|
1999-05-26 05:38:36 +04:00
|
|
|
if (!*line)
|
|
|
|
*line = (char*)PR_Malloc(bufferSize + 1);
|
|
|
|
if (!mInputStream)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
nsInputFileStream s(mInputStream);
|
1999-06-23 03:21:00 +04:00
|
|
|
*wasTruncated = !s.readline(*line, bufferSize);
|
1999-05-26 05:38:36 +04:00
|
|
|
return s.error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Write(const char * data, PRInt32 requestedCount, PRInt32 *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
1999-07-16 16:57:45 +04:00
|
|
|
//if (!mOutputStream)
|
|
|
|
// return NS_ERROR_NULL_POINTER;
|
1999-07-02 10:31:31 +04:00
|
|
|
if (!mOutputStream) {
|
1999-08-25 09:26:25 +04:00
|
|
|
nsresult rv = OpenStreamForWriting();
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
return rv;
|
1999-07-02 10:31:31 +04:00
|
|
|
}
|
1999-05-26 05:38:36 +04:00
|
|
|
nsOutputFileStream s(mOutputStream);
|
|
|
|
*_retval = s.write(data, requestedCount);
|
|
|
|
return s.error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Flush()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
if (!mOutputStream)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
nsOutputFileStream s(mOutputStream);
|
|
|
|
s.flush();
|
|
|
|
return s.error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Seek(PRInt32 offset)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
nsresult result = NS_OK;
|
|
|
|
if (mOutputStream)
|
|
|
|
{
|
|
|
|
nsOutputFileStream os(mOutputStream);
|
|
|
|
os.seek(offset);
|
|
|
|
result = os.error();
|
|
|
|
}
|
|
|
|
if (NS_SUCCEEDED(result) && mInputStream)
|
|
|
|
{
|
|
|
|
nsInputFileStream is(mInputStream);
|
|
|
|
is.seek(offset);
|
|
|
|
result = is.error();
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::Tell(PRInt32 *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
if (!mInputStream)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
nsInputFileStream s(mInputStream);
|
|
|
|
*_retval = s.tell();
|
|
|
|
return s.error();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsFileSpecImpl::EndLine()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
nsOutputFileStream s(mOutputStream);
|
|
|
|
s << nsEndl;
|
|
|
|
return s.error();
|
|
|
|
}
|
|
|
|
|
1999-08-23 14:14:16 +04:00
|
|
|
NS_IMPL_ISUPPORTS1(nsDirectoryIteratorImpl, nsIDirectoryIterator)
|
1999-05-26 05:38:36 +04:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
nsDirectoryIteratorImpl::nsDirectoryIteratorImpl()
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
: mDirectoryIterator(nsnull)
|
|
|
|
{
|
|
|
|
NS_INIT_ISUPPORTS();
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
nsDirectoryIteratorImpl::~nsDirectoryIteratorImpl()
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
delete mDirectoryIterator;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-07-28 03:33:54 +04:00
|
|
|
NS_IMETHODIMP nsDirectoryIteratorImpl::Init(nsIFileSpec *parent, PRBool resolveSymlink)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
delete mDirectoryIterator;
|
1999-07-28 03:33:54 +04:00
|
|
|
mDirectoryIterator = new nsDirectoryIterator(FILESPEC(parent), resolveSymlink);
|
1999-05-26 05:38:36 +04:00
|
|
|
if (!mDirectoryIterator)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsDirectoryIteratorImpl::Exists(PRBool *_retval)
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
TEST_OUT_PTR(_retval)
|
|
|
|
if (!mDirectoryIterator)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
*_retval = mDirectoryIterator->Exists();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
1999-08-25 09:26:25 +04:00
|
|
|
NS_IMETHODIMP nsDirectoryIteratorImpl::Next()
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
if (!mDirectoryIterator)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
(*mDirectoryIterator)++;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP nsDirectoryIteratorImpl::GetCurrentSpec(nsIFileSpec * *aCurrentSpec)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
if (!mDirectoryIterator)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
return nsFileSpecImpl::MakeInterface(mDirectoryIterator->Spec(), aCurrentSpec);
|
|
|
|
}
|
|
|
|
|
1999-06-15 02:05:41 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
NS_METHOD nsDirectoryIteratorImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
if (aIFileSpec == NULL)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
|
|
|
nsDirectoryIteratorImpl* it = new nsDirectoryIteratorImpl;
|
|
|
|
if (!it)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
nsresult rv = it->QueryInterface(aIID, aIFileSpec);
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
{
|
|
|
|
delete it;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-05-29 05:28:25 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-05-28 04:50:42 +04:00
|
|
|
NS_METHOD nsFileSpecImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aIFileSpec)
|
1999-05-29 05:28:25 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-05-28 04:50:42 +04:00
|
|
|
{
|
|
|
|
if (aIFileSpec == NULL)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
|
|
|
nsFileSpecImpl* it = new nsFileSpecImpl;
|
|
|
|
if (!it)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
1999-05-29 02:09:32 +04:00
|
|
|
nsresult rv = it->QueryInterface(aIID, aIFileSpec);
|
1999-06-15 02:05:41 +04:00
|
|
|
if (NS_FAILED(rv))
|
|
|
|
{
|
1999-05-28 04:50:42 +04:00
|
|
|
delete it;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
1999-06-10 00:49:39 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
1999-06-22 09:03:30 +04:00
|
|
|
nsresult NS_NewFileSpecWithSpec(const nsFileSpec& aSrcFileSpec, nsIFileSpec **result)
|
1999-06-10 00:49:39 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
|
|
|
if (!result)
|
|
|
|
return NS_ERROR_NULL_POINTER;
|
|
|
|
|
|
|
|
return nsFileSpecImpl::MakeInterface(aSrcFileSpec, result);
|
|
|
|
}
|
|
|
|
|
1999-05-26 05:38:36 +04:00
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
nsresult NS_NewFileSpec(nsIFileSpec** result)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
1999-12-01 02:36:32 +03:00
|
|
|
return nsFileSpecImpl::Create(nsnull, NS_GET_IID(nsIFileSpec), (void**)result);
|
1999-05-26 05:38:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
nsresult NS_NewDirectoryIterator(nsIDirectoryIterator** result)
|
|
|
|
//----------------------------------------------------------------------------------------
|
|
|
|
{
|
1999-12-01 02:36:32 +03:00
|
|
|
return nsDirectoryIteratorImpl::Create(nsnull, NS_GET_IID(nsIDirectoryIterator), (void**)result);
|
1999-05-26 05:38:36 +04:00
|
|
|
}
|