1 | /* $Id: path.h 2981 2007-06-01 16:01:28Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * innotek Portable Runtime - RTPath Internal header.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
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 as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 | #ifndef __path_h__
|
---|
23 | #define __path_h__
|
---|
24 |
|
---|
25 | #include <iprt/cdefs.h>
|
---|
26 | #include <iprt/param.h>
|
---|
27 |
|
---|
28 | __BEGIN_DECLS
|
---|
29 | extern char g_szrtProgramPath[RTPATH_MAX];
|
---|
30 |
|
---|
31 | #if defined(__OS2__) || defined(__WIN__)
|
---|
32 | # define HAVE_UNC 1
|
---|
33 | # define HAVE_DRIVE 1
|
---|
34 | #endif
|
---|
35 |
|
---|
36 |
|
---|
37 | int rtPathPosixRename(const char *pszSrc, const char *pszDst, unsigned fRename, RTFMODE fFileType);
|
---|
38 | int rtPathWin32MoveRename(const char *pszSrc, const char *pszDst, uint32_t fFlags, RTFMODE fFileType);
|
---|
39 |
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Converts a path from IPRT to native representation.
|
---|
43 | *
|
---|
44 | * This may involve querying filesystems what codeset they
|
---|
45 | * speak and so forth.
|
---|
46 | *
|
---|
47 | * @returns IPRT status code.
|
---|
48 | * @param ppszNativePath Where to store the pointer to the native path.
|
---|
49 | * Free by calling rtPathFreeHost(). NULL on failure.
|
---|
50 | * @param pszPath The path to convert.
|
---|
51 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
52 | */
|
---|
53 | int rtPathToNative(char **ppszNativePath, const char *pszPath);
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Converts a path from IPRT to native representation.
|
---|
57 | *
|
---|
58 | * This may involve querying filesystems what codeset they
|
---|
59 | * speak and so forth.
|
---|
60 | *
|
---|
61 | * @returns IPRT status code.
|
---|
62 | * @param ppszNativePath Where to store the pointer to the native path.
|
---|
63 | * Free by calling rtPathFreeHost(). NULL on failure.
|
---|
64 | * @param pszPath The path to convert.
|
---|
65 | * @param pszBasePath What pszPath is relative to. If NULL the function behaves like rtPathToNative().
|
---|
66 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
67 | */
|
---|
68 | int rtPathToNativeEx(char **ppszNativePath, const char *pszPath, const char *pszBasePath);
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Frees a native path returned by rtPathToNative() or rtPathToNativeEx().
|
---|
72 | *
|
---|
73 | * @param pszNativePath The host path to free. NULL allowed.
|
---|
74 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
75 | */
|
---|
76 | void rtPathFreeNative(char *pszNativePath);
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Converts a path from the native to the IPRT representation.
|
---|
80 | *
|
---|
81 | * @returns IPRT status code.
|
---|
82 | * @param ppszPath Where to store the pointer to the IPRT path.
|
---|
83 | * Free by calling RTStrFree(). NULL on failure.
|
---|
84 | * @param pszNativePath The native path to convert.
|
---|
85 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
86 | */
|
---|
87 | int rtPathFromNative(char **ppszPath, const char *pszNativePath);
|
---|
88 |
|
---|
89 | /**
|
---|
90 | * Converts a path from the native to the IPRT representation.
|
---|
91 | *
|
---|
92 | * @returns IPRT status code.
|
---|
93 | * @param ppszPath Where to store the pointer to the IPRT path.
|
---|
94 | * Free by calling RTStrFree(). NULL on failure.
|
---|
95 | * @param pszNativePath The native path to convert.
|
---|
96 | * @param pszBasePath What pszHostPath is relative to - in IPRT representation.
|
---|
97 | * If NULL the function behaves like rtPathFromNative().
|
---|
98 | * @remark This function is not available on hosts using something else than byte seqences as names. (eg win32)
|
---|
99 | */
|
---|
100 | int rtPathFromNativeEx(char **ppszPath, const char *pszNativePath, const char *pszBasePath);
|
---|
101 |
|
---|
102 |
|
---|
103 | __END_DECLS
|
---|
104 |
|
---|
105 | #endif
|
---|
106 |
|
---|