summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorFrancois Tigeot <ftigeot@wolfpond.org>2011-07-13 11:20:10 +0200
committerFrancois Tigeot <ftigeot@wolfpond.org>2011-07-16 07:19:29 +0200
commit861f8ece769bf05c138aac080706e0d97bf5fd10 (patch)
tree79e90f4cc3536b78a817cbcc94a3e73dcaf69559 /sal
parent6572e15d7ede0b3cc37b775a2f80f26dec4b8077 (diff)
Simplify osl_getTempDirURL()
Do not return different values depending on the platform
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/tempfile.c42
1 files changed, 9 insertions, 33 deletions
diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c
index 4e5abae826a2..3b55bdac2694 100644
--- a/sal/osl/unx/tempfile.c
+++ b/sal/osl/unx/tempfile.c
@@ -49,53 +49,29 @@
#include "file_url.h"
#endif
-/*****************************************************************/
-/* osl_getTempFirURL */
-/*****************************************************************/
-
oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir )
{
-#ifdef MACOSX
+ oslFileError error;
+ /* described in environ(7) */
const char *pValue = getenv( "TMPDIR" );
- /* If TMPDIR environment variable is not set, use "/tmp" instead
- of P_tmpdir because its value is "/var/tmp" and it is not
- deleted on system start up */
if ( !pValue )
- pValue = "/tmp";
-#else
-
- const char *pValue = getenv( "TEMP" );
+ pValue = getenv( "TEMP" );
if ( !pValue )
pValue = getenv( "TMP" );
-#if defined(NETBSD)
- if ( !pValue )
- pValue = _PATH_TMP;
-#else
- if ( !pValue )
- pValue = P_tmpdir;
-#endif
-
if ( !pValue )
pValue = "/tmp";
-#endif /* MACOSX */
- if ( pValue )
- {
- oslFileError error;
- rtl_uString *ustrTempPath = NULL;
+ rtl_uString *ustrTempPath = NULL;
- rtl_string2UString( &ustrTempPath, pValue, strlen( pValue ), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
- OSL_ASSERT(ustrTempPath != NULL);
- error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir );
- rtl_uString_release( ustrTempPath );
+ rtl_string2UString( &ustrTempPath, pValue, strlen( pValue ), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
+ OSL_ASSERT(ustrTempPath != NULL);
+ error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir );
+ rtl_uString_release( ustrTempPath );
- return error;
- }
- else
- return osl_File_E_NOENT;
+ return error;
}
/******************************************************************