source: branches/guitools-1.0/shared/inittempdir.vrs

Last change on this file was 302, checked in by Herwig Bauernfeind, 16 years ago

GUI tools: Add free space check on TMPDIR

File size: 1.7 KB
Line 
1/* Initialize the temporary directory */
2
3/*:VRX */
4_InitTempDir:
5 IF options.!debug == 1 THEN say '_InitTempDir() started'
6 /* Get temporary directory */
7 HaveNoTMPDIR = 0
8 TempDir = translate(value('TMPDIR',,'OS2ENVIRONMENT'),'\','/')
9 IF options.!debug == 1 THEN say ' TMPDIR="'TempDir'"'
10 if TempDir = '' then do
11 HaveNoTMPDIR = 1
12 TempDir = translate(value('TEMP',,'OS2ENVIRONMENT'),'\','/')
13 IF options.!debug == 1 THEN say ' TEMP="'TempDir'"'
14 end
15 if TempDir = '' then do
16 TempDir = translate(value('TMP',,'OS2ENVIRONMENT'),'\','/')
17 IF options.!debug == 1 THEN say ' TMP="'TempDir'"'
18 end
19 if TempDir = '' then do
20 TempDir = directory()
21 IF options.!debug == 1 THEN say ' Use current dir="'TempDir'"'
22 end
23 if HaveNoTMPDIR then do
24 say 'WARNING! Setting missing TMPDIR variable to "'TempDir'".'
25 IF options.!debug == 1 THEN say ' WARNING! Setting missing TMPDIR variable to "'TempDir'".'
26 ok = value('TMPDIR',TempDir,'OS2ENVIRONMENT')
27 end
28 TempDir = strip(TempDir,'T','\')||'\' /* make sure there is trailing "\" */
29
30 IF options.!debug == 1 THEN say '_InitTempDir() done, will use "'TempDir'"'
31return
32
33_ChkTempFreeSpace:
34 IF options.!debug == 1 THEN say '_ChkTempFreeSpace() started'
35 /* Check free space */
36 TempDrvInfo = SysDriveInfo(left(TempDir,2))
37 parse var TempDrvInfo . TempFreeSpace . .
38 if TempFreeSpace < 1048576 then do
39 say 'Warning: Free space on "'||TempDir||'" low!'
40 end
41 drop TempDrvInfo
42 IF options.!debug == 1 THEN say '_ChkTempFreeSpace() done, got "'TempFreeSpace'"'
43return TempFreeSpace
Note: See TracBrowser for help on using the repository browser.