summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorHennes Rohling <hro@openoffice.org>2002-08-19 08:13:45 +0000
committerHennes Rohling <hro@openoffice.org>2002-08-19 08:13:45 +0000
commit01e287751d1e03cef78cdc6523feb20ec293561b (patch)
treeb8f29f85042601c587a33fe7720ae72dcc984c0b /sal
parent4682179695d0d528fc3cda164e6cf94f112681b6 (diff)
#100821# osl_getTempDirURL added
Diffstat (limited to 'sal')
-rw-r--r--sal/osl/unx/makefile.mk10
-rw-r--r--sal/osl/unx/tempfile.c31
2 files changed, 37 insertions, 4 deletions
diff --git a/sal/osl/unx/makefile.mk b/sal/osl/unx/makefile.mk
index 6b1d86559793..b6552d31586a 100644
--- a/sal/osl/unx/makefile.mk
+++ b/sal/osl/unx/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.13 $
+# $Revision: 1.14 $
#
-# last change: $Author: hr $ $Date: 2001-05-02 15:03:13 $
+# last change: $Author: hro $ $Date: 2002-08-19 09:13:45 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -99,7 +99,8 @@ SLOFILES= $(SLO)$/conditn.obj \
$(SLO)$/signal.obj \
$(SLO)$/pipe.obj \
$(SLO)$/system.obj \
- $(SLO)$/util.obj
+ $(SLO)$/util.obj \
+ $(SLO)$/tempfile.obj
#.IF "$(UPDATER)"=="YES"
OBJFILES= $(OBJ)$/conditn.obj \
@@ -119,7 +120,8 @@ OBJFILES= $(OBJ)$/conditn.obj \
$(OBJ)$/signal.obj \
$(OBJ)$/pipe.obj \
$(OBJ)$/system.obj \
- $(OBJ)$/util.obj
+ $(OBJ)$/util.obj \
+ $(OBJ)$/tempfile.obj
#.ENDIF
# --- Targets ------------------------------------------------------
diff --git a/sal/osl/unx/tempfile.c b/sal/osl/unx/tempfile.c
new file mode 100644
index 000000000000..80e5c8419091
--- /dev/null
+++ b/sal/osl/unx/tempfile.c
@@ -0,0 +1,31 @@
+#include "system.h"
+
+#include <osl/file.h>
+
+oslFileError SAL_CALL osl_getTempDirURL( rtl_uString** pustrTempDir )
+{
+ const char *pValue = getenv( "TEMP" );
+
+ if ( !pValue )
+ {
+ pValue = getenv( "TMP" );
+#if defined(SOLARIS) || defined (LINUX)
+ if ( !pValue )
+ pValue = P_tmpdir;
+#endif
+ }
+
+ if ( pValue )
+ {
+ oslFileError error;
+ rtl_uString *ustrTempPath = NULL;
+
+ rtl_string2UString( &ustrTempPath, pValue, strlen( pValue ), osl_getThreadTextEncoding(), OSTRING_TO_OUSTRING_CVTFLAGS );
+ error = osl_getFileURLFromSystemPath( ustrTempPath, pustrTempDir );
+ rtl_uString_release( ustrTempPath );
+
+ return error;
+ }
+ else
+ return osl_File_E_NOENT;
+}