UseLSX "*javacon"
Function getTempDirectory() As String
On Error GoTo trataerro
Dim t_sesJava As New JavaSession
Dim t_clsFile As JavaClass
Set t_clsFile = t_sesJava.GetClass("java/io/File")
Dim t_mthCreateTemp As JavaMethod
Set t_mthCreateTemp = t_clsFile.GetMethod("createTempFile", "(Ljava/lang/String;Ljava/lang/String;)Ljava/io/File;")
Dim t_hflFile As JavaObject
Set t_hflFile = t_mthCreateTemp.Invoke(, "tdoc_dir", ".tmp")
Dim strParent As String
strParent = strLeftBack(t_hflFile.getPath(),"\")
If InStr(strParent, "/") <> 0 And Right(strParent, 1) <> "/" Then strParent = strParent & "/"
If InStr(strParent, "\") <> 0 And Right(strParent, 1) <> "\" Then strParent = strParent & "\"
getTempDirectory = strParent
Exit Function
trataerro:
Call AddToStackTrace()
End Function
Nenhum comentário:
Postar um comentário