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  bool use_guid=false);
40 UT_API bool UTgetTmpName(
42  const char *prefix=0,
43  bool use_guid=false);
44 /// @}
45 
46 /// Returns a path to a non-existent filename within the given directory.
47 /// @note This doesn't guarentee that the filename will still be non-existent
48 /// by the time it is opened.
49 /// @{
52  const char *parent_dir,
53  const char *prefix=0,
54  bool use_guid=false);
57  const char *parent_dir,
58  const char *prefix=0,
59  bool use_guid=false);
60 /// @}
61 
62 /// Returns the user directory. On Windows, this returns the `/Users/<name>` (ie.
63 /// the equivalent to `%HOMEPATH%`). For other platforms, it is the value of the
64 /// HOME environment variable.
65 UT_API const char *UTgetPersonalDir();
66 
67 /// Returns the path to the platform specific user desktop directory.
68 UT_API const char *UTgetDesktopDir();
69 
70 /// This should only really be used by UT_EnvControl as the default for
71 /// HOUDINI_TEMP_DIR when it's not set by the user. Use UTgetTmpDir()
72 /// everywhere else so that the user may override the location.
73 UT_API const char *UTgetDefaultTmpDir();
74 
75 /// Return a temporary file that will be deleted when it is closed. On some
76 /// operating systems, the file will be cached in memory if it does not exceed
77 /// a threshold size.
78 UT_API FILE *UTgetTmpFile();
79 
80 #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 UTgetTmpNameInDir(UT_String &filename, const char *parent_dir, const char *prefix=0, bool use_guid=false)
UT_API const char * UTgetTmpDir()
UT_API const char * UTgetDesktopDir()
Returns the path to the platform specific user desktop directory.
UT_API bool UTgetTmpName(UT_String &filename, const char *prefix=0, bool use_guid=false)
SYSdeclareStaticObject(UT_API, theTmpDirLock)