VirtualBox

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

Last change on this file since 106945 was 102315, checked in by vboxsync, 12 months ago

libs/xpcom: Remove VBOX_MACOSX_FOLLOWS_UNIX_IO which is the default for a long time now and get rid of the OSX specific code which is not used, bugref:10545

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 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 <iprt/err.h>
69
70#include <errno.h>
71
72#include "nsILocalFile.h"
73
74#if defined(XP_UNIX) || defined(XP_BEOS)
75#include "nsLocalFileUnix.h"
76#else
77#error NOT_IMPLEMENTED
78#endif
79
80
81#define NSRESULT_FOR_IPRT(ret) (RT_FAILURE((ret)) ? nsresultForIprt(ret) : NS_OK)
82
83inline nsresult
84nsresultForIprt(int err)
85{
86 switch (err) {
87 case VINF_SUCCESS:
88 return NS_OK;
89 case VERR_NOT_FOUND:
90 case VERR_FILE_NOT_FOUND:
91 case VERR_PATH_NOT_FOUND:
92 return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST;
93 case VERR_NOT_A_DIRECTORY:
94 return NS_ERROR_FILE_DESTINATION_NOT_DIR;
95 case VERR_NOT_SYMLINK:
96 return NS_ERROR_FILE_UNRESOLVABLE_SYMLINK;
97 case VERR_ALREADY_EXISTS:
98 return NS_ERROR_FILE_ALREADY_EXISTS;
99 case VERR_ACCESS_DENIED:
100 return NS_ERROR_FILE_ACCESS_DENIED;
101 default:
102 return NS_ERROR_FAILURE;
103 }
104}
105
106#define NSRESULT_FOR_ERRNO() nsresultForIprt(RTErrConvertFromErrno(errno))
107
108void NS_StartupLocalFile();
109void NS_ShutdownLocalFile();
110
111#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