1 | /* $Id: path.h 20364 2009-06-08 00:17:43Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - RTPath Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Sun Microsystems, Inc.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * The contents of this file may alternatively be used under the terms
|
---|
18 | * of the Common Development and Distribution License Version 1.0
|
---|
19 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
20 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
21 | * CDDL are applicable instead of those of the GPL.
|
---|
22 | *
|
---|
23 | * You may elect to license modified versions of this file under the
|
---|
24 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
25 | *
|
---|
26 | * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
|
---|
27 | * Clara, CA 95054 USA or visit http://www.sun.com if you need
|
---|
28 | * additional information or have any questions.
|
---|
29 | */
|
---|
30 |
|
---|
31 | #ifndef ___internal_path_h
|
---|
32 | #define ___internal_path_h
|
---|
33 |
|
---|
34 | #include <iprt/cdefs.h>
|
---|
35 | #include <iprt/param.h>
|
---|
36 |
|
---|
37 | RT_BEGIN_DECLS
|
---|
38 |
|
---|
39 | #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
|
---|
40 | # define HAVE_UNC 1
|
---|
41 | # define HAVE_DRIVE 1
|
---|
42 | #endif
|
---|
43 |
|
---|
44 |
|
---|
45 | int rtPathPosixRename(const char *pszSrc, const char *pszDst, unsigned fRename, RTFMODE fFileType);
|
---|
46 | int rtPathWin32MoveRename(const char *pszSrc, const char *pszDst, uint32_t fFlags, RTFMODE fFileType);
|
---|
47 |
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Converts a path from IPRT to native representation.
|
---|
51 | *
|
---|
52 | * This may involve querying filesystems what codeset they
|
---|
53 | * speak and so forth.
|
---|
54 | *
|
---|
55 | * @returns IPRT status code.
|
---|
56 | * @param ppszNativePath Where to store the pointer to the native path.
|
---|
57 | * Free by calling rtPathFreeHost(). NULL on failure.
|
---|
58 | * @param pszPath The path to convert.
|
---|
59 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
60 | */
|
---|
61 | int rtPathToNative(char **ppszNativePath, const char *pszPath);
|
---|
62 |
|
---|
63 | /**
|
---|
64 | * Converts a path from IPRT to native representation.
|
---|
65 | *
|
---|
66 | * This may involve querying filesystems what codeset they
|
---|
67 | * speak and so forth.
|
---|
68 | *
|
---|
69 | * @returns IPRT status code.
|
---|
70 | * @param ppszNativePath Where to store the pointer to the native path.
|
---|
71 | * Free by calling rtPathFreeHost(). NULL on failure.
|
---|
72 | * @param pszPath The path to convert.
|
---|
73 | * @param pszBasePath What pszPath is relative to. If NULL the function behaves like rtPathToNative().
|
---|
74 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
75 | */
|
---|
76 | int rtPathToNativeEx(char **ppszNativePath, const char *pszPath, const char *pszBasePath);
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Frees a native path returned by rtPathToNative() or rtPathToNativeEx().
|
---|
80 | *
|
---|
81 | * @param pszNativePath The host path to free. NULL allowed.
|
---|
82 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
83 | */
|
---|
84 | void rtPathFreeNative(char *pszNativePath);
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * Converts a path from the native to the IPRT representation.
|
---|
88 | *
|
---|
89 | * @returns IPRT status code.
|
---|
90 | * @param ppszPath Where to store the pointer to the IPRT path.
|
---|
91 | * Free by calling RTStrFree(). NULL on failure.
|
---|
92 | * @param pszNativePath The native path to convert.
|
---|
93 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
94 | */
|
---|
95 | int rtPathFromNative(char **ppszPath, const char *pszNativePath);
|
---|
96 |
|
---|
97 | /**
|
---|
98 | * Converts a path from the native to the IPRT representation.
|
---|
99 | *
|
---|
100 | * @returns IPRT status code.
|
---|
101 | * @param ppszPath Where to store the pointer to the IPRT path.
|
---|
102 | * Free by calling RTStrFree(). NULL on failure.
|
---|
103 | * @param pszNativePath The native path to convert.
|
---|
104 | * @param pszBasePath What pszHostPath is relative to - in IPRT representation.
|
---|
105 | * If NULL the function behaves like rtPathFromNative().
|
---|
106 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
107 | */
|
---|
108 | int rtPathFromNativeEx(char **ppszPath, const char *pszNativePath, const char *pszBasePath);
|
---|
109 |
|
---|
110 |
|
---|
111 | RT_END_DECLS
|
---|
112 |
|
---|
113 | #endif
|
---|
114 |
|
---|