diff -r efdffe319da3 -r 1179d610a761 PCFilename.st --- a/PCFilename.st Thu Nov 13 11:45:07 2014 +0100 +++ b/PCFilename.st Thu Nov 13 12:11:08 2014 +0100 @@ -160,42 +160,49 @@ This is used, if no special preferences were defined in any of the TEMP-environment variables (see tempDirectory)." - |winDir vol tempDir| + |winDir vol tempDirString tempDir| + + "/ if no explicit temp dir environment variable has been specified, + "/ use the ALLUSERS common folder and create an stx_tmp folder there. + "/ this will only happen for services which are installed to run under system + "/ instead of under any particular user. - #('TMPDIR' 'TEMPDIR' 'TEMP' 'TMP') do:[:envVar | - tempDir isNil ifTrue:[ - tempDir := OperatingSystem getEnvironment:envVar. - tempDir notNil ifTrue:[ - "/ kludge when running cygwin: replace '/cygdrive/X/...' - "/ by X:\... - (tempDir startsWith:'/cygdrive/') ifTrue:[ - tempDir := tempDir withoutPrefix:'/cygdrive/'. - tempDir size > 2 ifTrue:[ - (tempDir at:2) == $/ ifTrue:[ - tempDir := (tempDir at:1) asString , ':' , - ((tempDir copyFrom:2) replaceAll:$/ with:$\). - ]. - ]. - ]. - tempDir asFilename exists ifTrue:[ - ^ tempDir asFilename. - ]. - ]. - ]. + #('STX_TMPDIR' 'ST_TMPDIR' 'TMPDIR' 'TEMPDIR' 'TEMP' 'TMP' 'ALLUSERSPROFILE') do:[:envVar | + tempDirString := OperatingSystem getEnvironment:envVar. + tempDirString notNil ifTrue:[ + "/ kludge when running cygwin: replace '/cygdrive/X/...' + "/ by X:\... + (tempDirString startsWith:'/cygdrive/') ifTrue:[ + tempDirString := tempDirString withoutPrefix:'/cygdrive/'. + tempDirString size > 2 ifTrue:[ + (tempDirString at:2) == $/ ifTrue:[ + tempDirString := (tempDirString at:1) asString , ':' , + ((tempDirString copyFrom:2) replaceAll:$/ with:$\). + ]. + ]. + ]. + tempDir := self named:tempDirString. + (tempDir exists and:[ tempDir isWritable ]) ifTrue:[ + ('Filename [info]: using tmp folder as specified by: ',envVar) infoPrintCR. + ^ tempDir asFilename. + ]. + ]. ]. winDir := OperatingSystem getWindowsDirectory asFilename. vol := winDir volume. tempDir := vol asFilename construct:'temp'. - tempDir exists ifTrue:[ ^tempDir ]. - - tempDir := vol asFilename construct:'tmp'. - tempDir exists ifTrue:[ ^tempDir ]. - - tempDir := winDir construct:'temp'. - tempDir exists ifTrue:[ ^tempDir ]. - - ^ '.\temp' asFilename + (tempDir exists and:[ tempDir isWritable ]) ifFalse:[ + tempDir := vol asFilename construct:'tmp'. + (tempDir exists and:[ tempDir isWritable ]) ifFalse:[ + tempDir := winDir construct:'temp'. + (tempDir exists and:[ tempDir isWritable ]) ifFalse:[ + tempDir := '.\temp' asFilename + ] + ] + ]. + ('Filename [info]: using fallback windows tmp folder: ',tempDir pathName) infoPrintCR. + ^ tempDir " Filename defaultTempDirectoryName @@ -917,14 +924,14 @@ !PCFilename class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.63 2014-07-24 13:19:05 ab Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.64 2014-11-13 11:11:08 cg Exp $' ! version_CVS - ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.63 2014-07-24 13:19:05 ab Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/PCFilename.st,v 1.64 2014-11-13 11:11:08 cg Exp $' ! version_SVN - ^ '$Id: PCFilename.st,v 1.63 2014-07-24 13:19:05 ab Exp $' + ^ '$Id: PCFilename.st,v 1.64 2014-11-13 11:11:08 cg Exp $' ! !