Get Temp Folder on Windows / Mac OSX / Linux

Mindwatering Incorporated

Author: Tripp W Black

Created: 01/10/2011 at 06:48 PM

 

Category:
Notes Developer Tips
LotusScript

Issue:
Need to get the system temporary files folder to write a temporary file.

Solution A:
tempdir = Environ("Temp")
fname = tempdir & "/" & expfilename

Solution B:
(Declarations)
Declare Function w32_OSGetSystemTempDirectory Lib "nnotes" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Declare Function mac_OSGetSystemTempDirectory Lib "NotesLib" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Declare Function linux_OSGetSystemTempDirectory Lib "libnotes.so" Alias "OSGetSystemTempDirectory" ( Byval S As String) As Integer
Const ERR_UNSUPPORTED_PLATFORM = 20300 ' or other value you choose.
reportlocpath = GetNotesTempDirectory()
If (reporttype="XLS") Then
' xls export
If (Instr(platformtype, "Windows", 5)>0) Then
' backslash
reportlocpath = reportlocpath & "\" & Cstr(Year(Today)) & Cstr(Month(Today)) & Cstr(Day(Today)) & "-Report.xls"
Else
' forward slash
reportlocpath = reportlocpath & "/" & Cstr(Year(Today)) & Cstr(Month(Today)) & Cstr(Day(Today)) & "-Report.xls"
End If

Else
' csv export
If (Instr(platformtype, "Windows", 5)>0) Then
' backslash
reportlocpath = reportlocpath & "\" & Cstr(Year(Today)) & Cstr(Month(Today)) & Cstr(Day(Today)) & "-Report.csv"
Else
' forward slash
reportlocpath = reportlocpath & "/" & Cstr(Year(Today)) & Cstr(Month(Today)) & Cstr(Day(Today)) & "-Report.csv"
End If
End If
End If



previous page