Corretta tempdir

git-svn-id: svn://10.65.10.50/trunk@2577 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-02-06 16:14:56 +00:00
parent 1ebc3c6da9
commit 34d1c9af2c

View File

@ -970,8 +970,9 @@ bool TFilename::ok() const
const TFilename& TFilename::tempdir()
{
static TFilename _tempdir;
const bool create = _tempdir.empty() || user().compare(_tempdir.right(user().len()), -1, TRUE);
if (_tempdir.empty())
if (create)
{
const char* dirpref = getenv("TEMP");
if (dirpref == NULL || *dirpref == '\0') dirpref = getenv("TMP");
@ -995,11 +996,13 @@ const TFilename& TFilename::tempdir()
if (ok)
{
TString16 user(user());
user.lower();
if (user.not_empty() && _tempdir.find(user) != _tempdir.len() - user.len())
_tempdir << SLASH << user;
TString16 theuser(user());
if (theuser.empty())
theuser = "prassi";
theuser.lower();
if (theuser.not_empty() && _tempdir.find(theuser) != _tempdir.len() - theuser.len())
_tempdir << SLASH << theuser;
_tempdir.lower();
if (!fexist(_tempdir))
ok = make_dir(_tempdir);