HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 
24 
25 /// Return the directory to create temp files within. This differs depending on
26 /// the OS and the HOUDINI_TEMP_DIR environment variable.
27 UT_API const char *UTgetTmpDir();
28 
29 /// Returns a path to a non-existent filename within UTgetTmpDir().
30 /// This is equivalent to UTgetTmpNameInDir(UTgetTmpDir(), prefix, filename).
31 /// If the function fails, filename is NULL.
32 /// @note This doesn't guarentee that the filename will still be non-existent
33 /// by the time it is opened.
34 UT_API bool UTgetTmpName(
35  UT_String &filename,
36  const char *prefix=0,
37  bool use_guid=false);
38 
39 /// Returns a path to a non-existent filename within the given directory.
40 /// @note This doesn't guarentee that the filename will still be non-existent
41 /// by the time it is opened.
43  UT_String &filename,
44  const char *parent_dir,
45  const char *prefix=0,
46  bool use_guid=false);
47 
48 /// Returns the user directory. On Windows, this returns the /Users/<name> (ie.
49 /// the equivalent to %HOMEPATH%). For other platforms, it is the value of the
50 /// HOME environment variable.
51 UT_API const char *UTgetPersonalDir();
52 
53 /// Returns the path to the platform specific user desktop directory.
54 UT_API const char *UTgetDesktopDir();
55 
56 /// This should only really be used by UT_EnvControl as the default for
57 /// HOUDINI_TEMP_DIR when it's not set by the user. Use UTgetTmpDir()
58 /// everywhere else so that the user may override the location.
59 UT_API const char *UTgetDefaultTmpDir();
60 
61 /// Return a temporary file that will be deleted when it is closed. On some
62 /// operating systems, the file will be cached in memory if it does not exceed
63 /// a threshold size.
64 UT_API FILE *UTgetTmpFile();
65 
66 #endif // __UT_TmpDir_H__
UT_API const char * UTgetPersonalDir()
#define UT_API
Definition: UT_API.h:12
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)