1 | /* $Id: path.h 28877 2010-04-28 19:10:47Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * IPRT - RTPath Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 Oracle Corporation
|
---|
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 |
|
---|
27 | #ifndef ___internal_path_h
|
---|
28 | #define ___internal_path_h
|
---|
29 |
|
---|
30 | #include <iprt/cdefs.h>
|
---|
31 | #include <iprt/param.h>
|
---|
32 |
|
---|
33 | RT_C_DECLS_BEGIN
|
---|
34 |
|
---|
35 | #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
|
---|
36 | # define HAVE_UNC 1
|
---|
37 | # define HAVE_DRIVE 1
|
---|
38 | #endif
|
---|
39 |
|
---|
40 |
|
---|
41 | DECLHIDDEN(size_t) rtPathRootSpecLen(const char *pszPath);
|
---|
42 | DECLHIDDEN(size_t) rtPathVolumeSpecLen(const char *pszPath);
|
---|
43 | DECLHIDDEN(int) rtPathPosixRename(const char *pszSrc, const char *pszDst, unsigned fRename, RTFMODE fFileType);
|
---|
44 | DECLHIDDEN(int) rtPathWin32MoveRename(const char *pszSrc, const char *pszDst, uint32_t fFlags, RTFMODE fFileType);
|
---|
45 |
|
---|
46 |
|
---|
47 | /**
|
---|
48 | * Converts a path from IPRT to native representation.
|
---|
49 | *
|
---|
50 | * This may involve querying filesystems what codeset they speak and so forth.
|
---|
51 | *
|
---|
52 | * @returns IPRT status code.
|
---|
53 | * @param ppszNativePath Where to store the pointer to the native path.
|
---|
54 | * Free by calling rtPathFreeHost(). NULL on failure.
|
---|
55 | * Can be the same as pszPath.
|
---|
56 | * @param pszPath The path to convert.
|
---|
57 | *
|
---|
58 | * @remark This function is not available on hosts using something else than
|
---|
59 | * 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 speak and so forth.
|
---|
67 | *
|
---|
68 | * @returns IPRT status code.
|
---|
69 | * @param ppszNativePath Where to store the pointer to the native path.
|
---|
70 | * Free by calling rtPathFreeHost(). NULL on failure.
|
---|
71 | * Can be the same as pszPath.
|
---|
72 | * @param pszPath The path to convert.
|
---|
73 | * @param pszBasePath What pszPath is relative to. If NULL the function
|
---|
74 | * behaves like rtPathToNative().
|
---|
75 | *
|
---|
76 | * @remark This function is not available on hosts using something else than
|
---|
77 | * byte seqences as names (eg win32).
|
---|
78 | */
|
---|
79 | int rtPathToNativeEx(char **ppszNativePath, const char *pszPath, const char *pszBasePath);
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * Frees a native path returned by rtPathToNative() or rtPathToNativeEx().
|
---|
83 | *
|
---|
84 | * @param pszNativePath The host path to free. NULL allowed.
|
---|
85 | * @param pszPath The original path. This is for checking if
|
---|
86 | * rtPathToNative returned the pointer to the original.
|
---|
87 | *
|
---|
88 | * @remark This function is not available on hosts using something else than
|
---|
89 | * byte seqences as names (eg win32).
|
---|
90 | */
|
---|
91 | void rtPathFreeNative(char *pszNativePath, const char *pszPath);
|
---|
92 |
|
---|
93 | /**
|
---|
94 | * Converts a path from the native to the IPRT representation.
|
---|
95 | *
|
---|
96 | * @returns IPRT status code.
|
---|
97 | * @param ppszPath Where to store the pointer to the IPRT path.
|
---|
98 | * Free by calling RTStrFree(). NULL on failure.
|
---|
99 | * @param pszNativePath The native path to convert.
|
---|
100 | *
|
---|
101 | * @remark This function is not available on hosts using something else than
|
---|
102 | * byte seqences as names (eg win32).
|
---|
103 | */
|
---|
104 | int rtPathFromNative(char **ppszPath, const char *pszNativePath);
|
---|
105 |
|
---|
106 | /**
|
---|
107 | * Converts a path from the native to the IPRT representation.
|
---|
108 | *
|
---|
109 | * @returns IPRT status code.
|
---|
110 | * @param ppszPath Where to store the pointer to the IPRT path.
|
---|
111 | * Free by calling RTStrFree(). NULL on failure.
|
---|
112 | * @param pszNativePath The native path to convert.
|
---|
113 | * @param pszBasePath What pszHostPath is relative to - in IPRT
|
---|
114 | * representation. If NULL the function behaves like
|
---|
115 | * rtPathFromNative().
|
---|
116 | *
|
---|
117 | * @remark This function is not available on hosts using something else than
|
---|
118 | * byte seqences as names (eg win32).
|
---|
119 | */
|
---|
120 | int rtPathFromNativeEx(char **ppszPath, const char *pszNativePath, const char *pszBasePath);
|
---|
121 |
|
---|
122 |
|
---|
123 | RT_C_DECLS_END
|
---|
124 |
|
---|
125 | #endif
|
---|
126 |
|
---|