VirtualBox

source: vbox/trunk/src/libs/xpcom18a4/xpcom/io/nsLocalFile.h@ 6542

Last change on this file since 6542 was 1, checked in by vboxsync, 55 years ago

import

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.7 KB
Line 
1/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2/* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
4 *
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * The Original Code is Mozilla Communicator client code, released
16 * March 31, 1998.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 1998-1999
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 *
25 * Alternatively, the contents of this file may be used under the terms of
26 * either of the GNU General Public License Version 2 or later (the "GPL"),
27 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
28 * in which case the provisions of the GPL or the LGPL are applicable instead
29 * of those above. If you wish to allow use of your version of this file only
30 * under the terms of either the GPL or the LGPL, and not to allow others to
31 * use your version of this file under the terms of the MPL, indicate your
32 * decision by deleting the provisions above and replace them with the notice
33 * and other provisions required by the GPL or the LGPL. If you do not delete
34 * the provisions above, a recipient may use your version of this file under
35 * the terms of any one of the MPL, the GPL or the LGPL.
36 *
37 * ***** END LICENSE BLOCK *****
38 *
39 * This Original Code has been modified by IBM Corporation. Modifications made by IBM
40 * described herein are Copyright (c) International Business Machines Corporation, 2000.
41 * Modifications to Mozilla code or documentation identified per MPL Section 3.3
42 *
43 * Date Modified by Description of modification
44 * 04/20/2000 IBM Corp. OS/2 build.
45 */
46
47#ifndef _NS_LOCAL_FILE_H_
48#define _NS_LOCAL_FILE_H_
49
50#define NS_LOCAL_FILE_CID {0x2e23e220, 0x60be, 0x11d3, {0x8c, 0x4a, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74}}
51
52#define NS_DECL_NSLOCALFILE_UNICODE_METHODS \
53 nsresult AppendUnicode(const PRUnichar *aNode); \
54 nsresult GetUnicodeLeafName(PRUnichar **aLeafName); \
55 nsresult SetUnicodeLeafName(const PRUnichar *aLeafName); \
56 nsresult CopyToUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName); \
57 nsresult CopyToFollowingLinksUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName); \
58 nsresult MoveToUnicode(nsIFile *aNewParentDir, const PRUnichar *aNewLeafName); \
59 nsresult GetUnicodeTarget(PRUnichar **aTarget); \
60 nsresult GetUnicodePath(PRUnichar **aPath); \
61 nsresult InitWithUnicodePath(const PRUnichar *aPath); \
62 nsresult AppendRelativeUnicodePath(const PRUnichar *aRelativePath);
63
64// nsXPComInit needs to know about how we are implemented,
65// so here we will export it. Other users should not depend
66// on this.
67
68#include <errno.h>
69#include "nsILocalFile.h"
70
71#ifdef XP_WIN
72#include "nsLocalFileWin.h"
73#elif defined(XP_MACOSX)
74#include "nsLocalFileOSX.h"
75#elif defined(XP_MAC)
76#include "nsLocalFileMac.h"
77#elif defined(L4ENV)
78 /* Major hack attack!!! */
79#include "nsLocalFileL4.h"
80#elif defined(XP_UNIX) || defined(XP_BEOS)
81#include "nsLocalFileUnix.h"
82#elif defined(XP_OS2)
83#include "nsLocalFileOS2.h"
84#else
85#error NOT_IMPLEMENTED
86#endif
87
88#define NSRESULT_FOR_RETURN(ret) (((ret) < 0) ? NSRESULT_FOR_ERRNO() : NS_OK)
89
90inline nsresult
91nsresultForErrno(int err)
92{
93 switch (err) {
94 case 0:
95 return NS_OK;
96 case ENOENT:
97 return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
98 case ENOTDIR:
99 return NS_ERROR_FILE_DESTINATION_NOT_DIR;
100#ifdef ENOLINK
101 case ENOLINK:
102 return NS_ERROR_FILE_UNRESOLVABLE_SYMLINK;
103#endif /* ENOLINK */
104 case EEXIST:
105 return NS_ERROR_FILE_ALREADY_EXISTS;
106#ifdef EPERM
107 case EPERM:
108#endif /* EPERM */
109 case EACCES:
110 return NS_ERROR_FILE_ACCESS_DENIED;
111 default:
112 return NS_ERROR_FAILURE;
113 }
114}
115
116#define NSRESULT_FOR_ERRNO() nsresultForErrno(errno)
117
118void NS_StartupLocalFile();
119void NS_ShutdownLocalFile();
120
121#endif
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette