1 | /* $Id: path.h 8245 2008-04-21 17:24:28Z 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 | __BEGIN_DECLS
|
---|
38 | extern char g_szrtProgramPath[RTPATH_MAX];
|
---|
39 |
|
---|
40 | #if defined(RT_OS_OS2) || defined(RT_OS_WINDOWS)
|
---|
41 | # define HAVE_UNC 1
|
---|
42 | # define HAVE_DRIVE 1
|
---|
43 | #endif
|
---|
44 |
|
---|
45 |
|
---|
46 | int rtPathPosixRename(const char *pszSrc, const char *pszDst, unsigned fRename, RTFMODE fFileType);
|
---|
47 | int rtPathWin32MoveRename(const char *pszSrc, const char *pszDst, uint32_t fFlags, RTFMODE fFileType);
|
---|
48 |
|
---|
49 |
|
---|
50 | /**
|
---|
51 | * Converts a path from IPRT to native representation.
|
---|
52 | *
|
---|
53 | * This may involve querying filesystems what codeset they
|
---|
54 | * speak and so forth.
|
---|
55 | *
|
---|
56 | * @returns IPRT status code.
|
---|
57 | * @param ppszNativePath Where to store the pointer to the native path.
|
---|
58 | * Free by calling rtPathFreeHost(). NULL on failure.
|
---|
59 | * @param pszPath The path to convert.
|
---|
60 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
61 | */
|
---|
62 | int rtPathToNative(char **ppszNativePath, const char *pszPath);
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Converts a path from IPRT to native representation.
|
---|
66 | *
|
---|
67 | * This may involve querying filesystems what codeset they
|
---|
68 | * speak and so forth.
|
---|
69 | *
|
---|
70 | * @returns IPRT status code.
|
---|
71 | * @param ppszNativePath Where to store the pointer to the native path.
|
---|
72 | * Free by calling rtPathFreeHost(). NULL on failure.
|
---|
73 | * @param pszPath The path to convert.
|
---|
74 | * @param pszBasePath What pszPath is relative to. If NULL the function behaves like rtPathToNative().
|
---|
75 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
76 | */
|
---|
77 | int rtPathToNativeEx(char **ppszNativePath, const char *pszPath, const char *pszBasePath);
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * Frees a native path returned by rtPathToNative() or rtPathToNativeEx().
|
---|
81 | *
|
---|
82 | * @param pszNativePath The host path to free. NULL allowed.
|
---|
83 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
84 | */
|
---|
85 | void rtPathFreeNative(char *pszNativePath);
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Converts a path from the native to the IPRT representation.
|
---|
89 | *
|
---|
90 | * @returns IPRT status code.
|
---|
91 | * @param ppszPath Where to store the pointer to the IPRT path.
|
---|
92 | * Free by calling RTStrFree(). NULL on failure.
|
---|
93 | * @param pszNativePath The native path to convert.
|
---|
94 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
95 | */
|
---|
96 | int rtPathFromNative(char **ppszPath, const char *pszNativePath);
|
---|
97 |
|
---|
98 | /**
|
---|
99 | * Converts a path from the native to the IPRT representation.
|
---|
100 | *
|
---|
101 | * @returns IPRT status code.
|
---|
102 | * @param ppszPath Where to store the pointer to the IPRT path.
|
---|
103 | * Free by calling RTStrFree(). NULL on failure.
|
---|
104 | * @param pszNativePath The native path to convert.
|
---|
105 | * @param pszBasePath What pszHostPath is relative to - in IPRT representation.
|
---|
106 | * If NULL the function behaves like rtPathFromNative().
|
---|
107 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
108 | */
|
---|
109 | int rtPathFromNativeEx(char **ppszPath, const char *pszNativePath, const char *pszBasePath);
|
---|
110 |
|
---|
111 |
|
---|
112 | __END_DECLS
|
---|
113 |
|
---|
114 | #endif
|
---|
115 |
|
---|