- Portions of nsIFile and nsIDirectoryEnumerator implementations for Unix.

- Various missing-newline-at-end-of-file fixes from Andrew Taylor
  <Andrew.Taylor@cal.montage.ca>.
- Fixed case in nsIDirectoryEnumerator.idl
- Added |normalize()|, |truncate()| and |target|, |isSpecial()| to nsIFile.idl
- Changed |isExists()| to |exists()|, |fileName| to |leafName|, |isEqual()| to
  |equals| and added |in boolean recur| to |isContainedIn()|.
- Corrected widespread misspelling of |NS_ERROR_FILE_UNRECOGNIZED_PATH|.
- Partially updated Windows code to track changes.
Partially addresses 17948, r=dougt
This commit is contained in:
shaver%netscape.com 1999-11-29 14:55:03 +00:00
Родитель 5bd63e6b95
Коммит 528cb517ac
11 изменённых файлов: 44 добавлений и 181 удалений

Просмотреть файл

@ -1,38 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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/
*
* 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.
*
* The Original Code is Mozilla Communicator client code,
* released March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Doug Turner <dougt@netscape.com>
*/
#ifndef _NSIFILEUTILS_H_
#define _NSIFILEUTILS_H_
#include "nscore.h"
#include "nsIFile.h"
#include "nsIDirectoryEnumerator.h"
// Helper function(s)
nsresult NS_COM NS_NewFile(nsIFile** file);
nsresult NS_COM NS_NewDirectoryEnumerator(nsIFile* parent, PRBool resolveSymlinks, nsIDirectoryEnumerator** enumerator);
#endif

Просмотреть файл

@ -1,40 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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/
*
* 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.
*
* The Original Code is Mozilla Communicator client code,
* released March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Doug Turner <dougt@netscape.com>
*/
#ifndef _NSIDIRENUMERATORIMPL_H_
#define _NSIDIRENUMERATORIMPL_H_
#define NS_IDIRECTORYENUMERATOR_CID {0xe67dcbe0, 0x6a21, 0x11d3, {0x8c, 0x51, 0x00, 0x60, 0x97, 0x92, 0x27, 0x8c}}
// nsXPComInit needs to know about how we are implmented,
// so here we will export it. Other users should not depend
// on this
#ifdef XP_PC
#include "nsIDirEnumeratorImplWin.h"
#else
#error NOT_IMPLEMENTED
#endif
#endif

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -1,38 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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/
*
* 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.
*
* The Original Code is Mozilla Communicator client code,
* released March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Doug Turner <dougt@netscape.com>
*/
#include "nsIEnumerator.idl"
interface nsIFile;
[scriptable, uuid(D7BEA930-59D7-11d3-8C46-00609792278C)]
interface nsIDirectoryEnumerator : nsISimpleEnumerator
{
void Init(in nsIFile parent, in boolean resolveSymlinks);
};
%{C++
#define NS_DIRECTORY_ENUMERATOR_PROGID "component://netscape/file/enumerator"
#define NS_DIRECTORY_ENUMERATOR_CLASS "Directory Enumerator"
%}

Просмотреть файл

@ -141,6 +141,11 @@ interface nsIFile : nsISupports
void appendPath([const] in string relativePath);
/**
* Normalize the pathName (e.g. removing .. and . components on Unix).
*/
void normalize();
/**
* create
*
@ -166,10 +171,9 @@ interface nsIFile : nsISupports
/**
* Accessor to the file name (the leaf name not the full file path)
* of the file itself.
* Accessor to the leaf name of the file itself.
*/
readonly attribute string fileName;
readonly attribute string leafName;
/**
* getPath
@ -275,18 +279,27 @@ interface nsIFile : nsISupports
*/
void delete(in boolean recursive);
/**
* Truncate the file to the given length.
*/
void truncate(in unsigned long length);
/**
* Attributes of nsIFile.
*/
attribute unsigned long lastModificationDate;
attribute unsigned long lastModificationDateOfLink;
attribute unsigned long permissions;
attribute unsigned long permissionsOfLink;
readonly attribute unsigned long fileSize;
readonly attribute unsigned long fileSizeOfLink;
attribute unsigned long lastModificationDateOfLink;
attribute unsigned long permissionsOfLink;
/* should we make this writable and have it map to truncate? */
readonly attribute unsigned long fileSizeOfLink;
/**
* Find out what the symlink points at. Will give error
* (NS_ERROR_FILE_INVALID_PATH) if not a symlink.
*/
readonly attribute string target;
readonly attribute long long diskSpaceAvailable; // maybe we should put this somewhere else.
@ -295,30 +308,36 @@ interface nsIFile : nsISupports
*/
readonly attribute nsIFile parent;
boolean isExists();
boolean isWriteable();
boolean exists();
boolean isWritable();
boolean isReadable();
boolean isExecutable();
boolean isHidden();
boolean isDirectory();
boolean isFile();
boolean isHidden();
boolean isSymlink();
/**
* Not a regular file, not a directory, not a symlink.
*/
boolean isSpecial();
/**
* Will determine if the inFile equals this.
*/
boolean isEqual(in nsIFile inFile);
boolean equals(in nsIFile inFile);
/**
* Will determine the file is a sibling of the parameter inFile.
* Will determine the file is a descendant of the parameter inFile.
* If |recur| is true, it will descend subdirectories looking for
*/
boolean isContainedIn(in nsIFile inFile);
boolean isContainedIn(in nsIFile inFile, in boolean recur);
};
%{C++
#define NS_FILE_PROGID "component://netscape/file"
#define NS_FILE_CLASSNAME "File Specification"
#define NS_ERROR_FILE_UNRECONGNIZED_PATH NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 1)
#define NS_ERROR_FILE_UNRECOGNIZED_PATH NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 1)
#define NS_ERROR_FILE_UNRESOLVABLE_SYMLINK NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 2)
#define NS_ERROR_FILE_EXECUTION_FAILED NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 3)
#define NS_ERROR_FILE_UNKNOWN_TYPE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_FILES, 4)

Просмотреть файл

@ -1,40 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/*
* 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/
*
* 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.
*
* The Original Code is Mozilla Communicator client code,
* released March 31, 1998.
*
* The Initial Developer of the Original Code is Netscape Communications
* Corporation. Portions created by Netscape are
* Copyright (C) 1998-1999 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
* Doug Turner <dougt@netscape.com>
*/
#ifndef _NSIFILEIMPL_H_
#define _NSIFILEIMPL_H_
#define NS_IFILEIMPL_CID {0x2e23e220, 0x60be, 0x11d3, {0x8c, 0x4a, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
// nsXPComInit needs to know about how we are implmented,
// so here we will export it. Other users should not depend
// on this.
#ifdef XP_PC
#include "nsIFileImplWin.h"
#else
#error NOT_IMPLEMENTED
#endif
#endif

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -422,9 +422,9 @@ nsIFileImpl::AppendPath(const char *node)
}
NS_IMETHODIMP
nsIFileImpl::GetFileName(char * *aFileName)
nsIFileImpl::GetLeafName(char * *aLeafName)
{
NS_ENSURE_ARG_POINTER(aFileName);
NS_ENSURE_ARG_POINTER(aLeafName);
const char* temp = mWorkingPath.GetBuffer();
if(temp == nsnull)
@ -438,7 +438,7 @@ nsIFileImpl::GetFileName(char * *aFileName)
else
leaf++;
*aFileName = (char*) nsAllocator::Clone(leaf, strlen(leaf)+1);
*aLeafName = (char*) nsAllocator::Clone(leaf, strlen(leaf)+1);
return NS_OK;
}
@ -873,7 +873,7 @@ nsIFileImpl::GetParent(nsIFile * *aParent)
return NS_OK;
}
NS_IMETHODIMP
nsIFileImpl::IsExists(PRBool *_retval)
nsIFileImpl::Exists(PRBool *_retval)
{
NS_ENSURE_ARG(_retval);
@ -889,7 +889,7 @@ nsIFileImpl::IsExists(PRBool *_retval)
}
NS_IMETHODIMP
nsIFileImpl::IsWriteable(PRBool *_retval)
nsIFileImpl::IsWritable(PRBool *_retval)
{
NS_ENSURE_ARG(_retval);
return NS_ERROR_NOT_IMPLEMENTED;
@ -962,7 +962,7 @@ nsIFileImpl::IsSymlink(PRBool *_retval)
}
NS_IMETHODIMP
nsIFileImpl::IsEqual(nsIFile *inFile, PRBool *_retval)
nsIFileImpl::Equals(nsIFile *inFile, PRBool *_retval)
{
NS_ENSURE_ARG(inFile);
NS_ENSURE_ARG(_retval);
@ -985,7 +985,7 @@ nsIFileImpl::IsEqual(nsIFile *inFile, PRBool *_retval)
}
NS_IMETHODIMP
nsIFileImpl::IsContainedIn(nsIFile *inFile, PRBool *_retval)
nsIFileImpl::IsContainedIn(nsIFile *inFile, PRBool recur, PRBool *_retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}