홈 · 개발 참고자료

개발 참고자료

[파워빌더] Determine the TEMP directory designated for temporary files.

작성자
관리자
작성일
2016-10-22
조회
12060
분류
파워빌더
In PB6, simply get the value of the environment variable TEMPContextKeyword lcxk_base
string ls_temp[]

this.GetContextService("Keyword", lcxk_base)
lcxk_base.getContextKeywords("TEMP", ls_temp)
RETURN ls_temp[1]

Or you can use the following API call[External function declaration]
FUNCTION ulong GetTempPath(ulong nBufferLength, ref string lpBuffer) &
LIBRARY "kernel32" ALIAS FOR GetTempPathA

[powerscript]
long ll_bufferlength = 256
string ls_tempDir

ls_tempDir = SPACE(ll_bufferLength)

IF GetTempPath(ll_bufferLength, ls_tempDir) = 0 THEN
MessageBox("Temp dir", "not defined")
ELSE
MessageBox("Temp dir", ls_tempDir)
END IF

The GetTempPath function gets the temporary file path as follows:The path specified by the TMP environment variable.

The path specified by the TEMP environment variable, if TMP is not defined.

The current directory, if both TMP and TEMP are not defined.