wxFileName::CreateTempFileName changes. Open the tempfiles read/write. Allow
self delting temp files to be created, where the OS supports it. Add support for opening wxFFile temp files. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@42277 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
		| @@ -32,6 +32,10 @@ | ||||
| class WXDLLIMPEXP_BASE wxFile; | ||||
| #endif | ||||
|  | ||||
| #if wxUSE_FFILE | ||||
| class WXDLLIMPEXP_BASE wxFFile; | ||||
| #endif | ||||
|  | ||||
| // ---------------------------------------------------------------------------- | ||||
| // constants | ||||
| // ---------------------------------------------------------------------------- | ||||
| @@ -266,15 +270,30 @@ public: | ||||
|     void AssignHomeDir(); | ||||
|     static wxString GetHomeDir(); | ||||
|  | ||||
| #if wxUSE_FILE || wxUSE_FFILE | ||||
|         // get a temp file name starting with the specified prefix | ||||
|     void AssignTempFileName(const wxString& prefix); | ||||
|     static wxString CreateTempFileName(const wxString& prefix); | ||||
| #endif // wxUSE_FILE | ||||
|  | ||||
| #if wxUSE_FILE | ||||
|         // get a temp file name starting with the specified prefix and open the | ||||
|         // file passed to us using this name for writing (atomically if | ||||
|         // possible) | ||||
|     void AssignTempFileName(const wxString& prefix, wxFile *fileTemp = NULL); | ||||
|     void AssignTempFileName(const wxString& prefix, wxFile *fileTemp); | ||||
|     static wxString CreateTempFileName(const wxString& prefix, | ||||
|                                        wxFile *fileTemp = NULL); | ||||
|                                        wxFile *fileTemp); | ||||
| #endif // wxUSE_FILE | ||||
|  | ||||
| #if wxUSE_FFILE | ||||
|         // get a temp file name starting with the specified prefix and open the | ||||
|         // file passed to us using this name for writing (atomically if | ||||
|         // possible) | ||||
|     void AssignTempFileName(const wxString& prefix, wxFFile *fileTemp); | ||||
|     static wxString CreateTempFileName(const wxString& prefix, | ||||
|                                        wxFFile *fileTemp); | ||||
| #endif // wxUSE_FFILE | ||||
|  | ||||
|     // directory creation and removal. | ||||
|     bool Mkdir( int perm = 0777, int flags = 0); | ||||
|     static bool Mkdir( const wxString &dir, int perm = 0777, int flags = 0 ); | ||||
|   | ||||
							
								
								
									
										56
									
								
								include/wx/private/filename.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								include/wx/private/filename.h
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,56 @@ | ||||
| ///////////////////////////////////////////////////////////////////////////// | ||||
| // Name:        include/wx/private/filename.h | ||||
| // Purpose:     Internal declarations for src/common/filename.cpp | ||||
| // Author:      Mike Wetherell | ||||
| // Modified by: | ||||
| // Created:     2006-10-22 | ||||
| // RCS-ID:      $Id$ | ||||
| // Copyright:   (c) 2006 Mike Wetherell | ||||
| // Licence:     wxWindows licence | ||||
| ///////////////////////////////////////////////////////////////////////////// | ||||
|  | ||||
| #ifndef _WX_PRIVATE_FILENAME_H_ | ||||
| #define _WX_PRIVATE_FILENAME_H_ | ||||
|  | ||||
| #include "wx/file.h" | ||||
| #include "wx/ffile.h" | ||||
|  | ||||
| // Self deleting temp files aren't supported on all platforms. Therefore | ||||
| // rather than let these be in the API, they can be used internally to | ||||
| // implement classes (e.g. wxTempFileStream), that will do the clean up when | ||||
| // the OS doesn't support it. | ||||
|  | ||||
| // Same usage as wxFileName::CreateTempFileName() with the extra parameter | ||||
| // deleteOnClose. *deleteOnClose true on entry requests a file created with a | ||||
| // delete on close flag, on exit the value of *deleteOnClose indicates whether | ||||
| // available. | ||||
|  | ||||
| #if wxUSE_FILE | ||||
| wxString wxCreateTempFileName(const wxString& prefix, | ||||
|                               wxFile *fileTemp, | ||||
|                               bool *deleteOnClose = NULL); | ||||
| #endif | ||||
|  | ||||
| #if wxUSE_FFILE | ||||
| wxString wxCreateTempFileName(const wxString& prefix, | ||||
|                               wxFFile *fileTemp, | ||||
|                               bool *deleteOnClose = NULL); | ||||
| #endif | ||||
|  | ||||
| // Returns an open temp file, if possible either an unlinked open file or one | ||||
| // that will delete on close. Only returns the filename if neither was | ||||
| // possible, so that the caller can delete the file when done. | ||||
|  | ||||
| #if wxUSE_FILE | ||||
| bool wxCreateTempFile(const wxString& prefix, | ||||
|                       wxFile *fileTemp, | ||||
|                       wxString *name); | ||||
| #endif | ||||
|  | ||||
| #if wxUSE_FFILE | ||||
| bool wxCreateTempFile(const wxString& prefix, | ||||
|                       wxFFile *fileTemp, | ||||
|                       wxString *name); | ||||
| #endif | ||||
|  | ||||
| #endif // _WX_PRIVATE_FILENAME_H_ | ||||
		Reference in New Issue
	
	Block a user