получение темпового пути Лотус кроссплатформенно

  • Автор темы hosm
  • Дата начала
H

hosm

получение темпового пути [post="166882"]отсюда[/post]
Пример от lmike: по файловому пути - домина юзает "свой" темп, и его надо получить (источника не помню, приведу код):
Код:
'Class_TempFolderManager:

Const ERR_UNSUPPORTED_PLATFORM = 20300 ' arbitrary value
Private agentLog As NotesLog
Class TempFolderManager
m_path As String
m_files List As Integer

Function Unique As String
Dim unik
unik = Evaluate("@Unique")
Unique = Strtoken(unik(0), "-", -1)    ' drop the username part of the ID which is always the same for this user
End Function

Sub New
m_path = GetNotesTempDirectory & "/" & Unique
Mkdir m_path
End Sub

Public Property Get Path As String
Path = m_path
End Property

Function NewFilename(Byval strSuffix$, Byval bManage As Boolean) As String
Dim strFName$
strFName = Unique
If strSuffix <> "" Then strFName = strFName & "." & strSuffix
NewFilename = m_path & "/" & strFName
If bManage Then
m_files(NewFilename) = 0
End If
End Function

Sub Manage(Byval strPath$)
m_files(strPath) = 1
End Sub

Sub Unmanage(Byval strPath$)
On Error Resume Next
Erase m_files(strPath)
End Sub

Function ClearFiles( ) As Boolean
' erase all files under management but leave the directory so that we can use it more.
' return True if all files were successfully erased.
On Error Goto failed
ClearFiles = True
Forall ffileno In m_files
Kill Listtag(ffileno)
nextFile:
End Forall
Erase m_files
Exit Function
failed:
ClearFiles = False
Resume nextFile
End Function

Sub Delete
On Error Resume Next
If ClearFiles Then Rmdir m_path
End Sub
End Class
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

Function GetNotesTempDirectory() As String
' Returns the path of the temporary directory used by Notes.
' Not same as system or user temp dir that you can get e.g. with Environ("TEMP") in Windows.
' Main reasons to use this instead: works crossplatform, and partitioned servers each need
' their own temp dir to avoid interfering with each other.
Dim session As New NotesSession
Dim d As String * 256
Dim s%
Select Case session.Platform
Case "Linux"
s% = linux_OSGetSystemTempDirectory(d)
Case "Macintosh"
s% = mac_OSGetSystemTempDirectory(d)
Case "Windows/32"
s% = w32_OSGetSystemTempDirectory(d)
Case Else
Error ERR_UNSUPPORTED_PLATFORM, "In GetNotesTempDirectory, platform not supported: " & session.Platform
End Select
GetNotesTempDirectory = Left$(d, s%)
End Function
P.S. Особенности Lotus в Mac OS X обсуждаются в начале темы Вопросы по Macos
 
Последнее редактирование модератором:
Мы в соцсетях:  ТелеграмВконтактеДзенФейсбукТвиттерЮтуб