Corretta tempdir
git-svn-id: svn://10.65.10.50/trunk@2577 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1ebc3c6da9
commit
34d1c9af2c
@ -970,8 +970,9 @@ bool TFilename::ok() const
|
|||||||
const TFilename& TFilename::tempdir()
|
const TFilename& TFilename::tempdir()
|
||||||
{
|
{
|
||||||
static 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");
|
const char* dirpref = getenv("TEMP");
|
||||||
if (dirpref == NULL || *dirpref == '\0') dirpref = getenv("TMP");
|
if (dirpref == NULL || *dirpref == '\0') dirpref = getenv("TMP");
|
||||||
@ -995,11 +996,13 @@ const TFilename& TFilename::tempdir()
|
|||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
TString16 user(user());
|
TString16 theuser(user());
|
||||||
|
|
||||||
user.lower();
|
if (theuser.empty())
|
||||||
if (user.not_empty() && _tempdir.find(user) != _tempdir.len() - user.len())
|
theuser = "prassi";
|
||||||
_tempdir << SLASH << user;
|
theuser.lower();
|
||||||
|
if (theuser.not_empty() && _tempdir.find(theuser) != _tempdir.len() - theuser.len())
|
||||||
|
_tempdir << SLASH << theuser;
|
||||||
_tempdir.lower();
|
_tempdir.lower();
|
||||||
if (!fexist(_tempdir))
|
if (!fexist(_tempdir))
|
||||||
ok = make_dir(_tempdir);
|
ok = make_dir(_tempdir);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user