HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_TmpDir.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: UT_TmpDir.h (UT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __UT_TmpDir_H__
12 #define __UT_TmpDir_H__
13 
14 #include "UT_API.h"
15 #include <stdio.h>
16 
17 
18 #include <SYS/SYS_StaticInit.h>
19 SYSdeclareStaticObject( UT_API, theTmpDirLock );
20 
21 
22 class UT_String;
23 class UT_StringHolder;
24 
25 
26 /// Return the directory to create temp files within. This differs depending on
27 /// the OS and the HOUDINI_TEMP_DIR environment variable.
28 UT_API const char *UTgetTmpDir();
29 
30 /// Returns a path to a non-existent filename within UTgetTmpDir().
31 /// This is equivalent to UTgetTmpNameInDir(UTgetTmpDir(), prefix, filename).
32 /// If the function fails, filename is NULL.
33 /// @note This doesn't guarentee that the filename will still be non-existent
34 /// by the time it is opened.
35 /// @{
36 UT_API bool UTgetTmpName(
38  const char *prefix=0);
39 UT_API bool UTgetTmpName(
41  const char *prefix=0);
42 /// @}
43 
44 /// Returns a path to a non-existent filename within the given directory.
45 /// @note This doesn't guarentee that the filename will still be non-existent
46 /// by the time it is opened.
47 /// @{
50  const char *parent_dir,
51  const char *prefix=0);
54  const char *parent_dir,
55  const char *prefix=0);
56 /// @}
57 
58 /// Returns the user directory. On Windows, this returns the `/Users/<name>` (ie.
59 /// the equivalent to `%HOMEPATH%`). For other platforms, it is the value of the
60 /// HOME environment variable.
61 UT_API const char *UTgetPersonalDir();
62 
63 /// Returns the path to the platform specific user desktop directory.
64 UT_API const char *UTgetDesktopDir();
65 
66 /// This should only really be used by UT_EnvControl as the default for
67 /// HOUDINI_TEMP_DIR when it's not set by the user. Use UTgetTmpDir()
68 /// everywhere else so that the user may override the location.
69 UT_API const char *UTgetDefaultTmpDir();
70 
71 /// Return a temporary file that will be deleted when it is closed. On some
72 /// operating systems, the file will be cached in memory if it does not exceed
73 /// a threshold size.
75 
76 #endif // __UT_TmpDir_H__
GT_API const UT_StringHolder filename
UT_API const char * UTgetPersonalDir()
#define UT_API
Definition: UT_API.h:14
UT_API const char * UTgetDefaultTmpDir()
UT_API FILE * UTgetTmpFile()
UT_API bool UTgetTmpName(UT_String &filename, const char *prefix=0)
UT_API bool UTgetTmpNameInDir(UT_String &filename, const char *parent_dir, const char *prefix=0)
UT_API const char * UTgetTmpDir()
UT_API const char * UTgetDesktopDir()
Returns the path to the platform specific user desktop directory.
SYSdeclareStaticObject(UT_API, theTmpDirLock)