About reliability of wxFileName::GetTempDir() under Windows

15 views
Skip to first unread message

Eric

unread,
Sep 28, 2012, 3:20:24 PM9/28/12
to wx-...@googlegroups.com
Hello. In a project of mine, sometime
wxFileName::GetTempDir() returns the right value and sometime just a
dot ("."). I've investigated and reported the full details in the
forum at
http://forums.wxwidgets.org/viewtopic.php?f=23&t=35907&p=147025. In
brief, it sounds like wxGetenv("TMPDIR") returns "." rather than an
empty string when TMPDIR is not defined in the system. I'm with
wxWidgets 2.9.3, TDM-GCC and Code::Blocks under a Windows 7 Pro with
TMP and TEMP environment variables well defined but without any
TMPDIR. Does this issue known ? Does wxWidgets 2.9.4 solved something
about this ?

Vadim Zeitlin

unread,
Sep 28, 2012, 4:28:51 PM9/28/12
to wx-...@googlegroups.com
On Fri, 28 Sep 2012 21:20:24 +0200 Eric wrote:

E> http://forums.wxwidgets.org/viewtopic.php?f=23&t=35907&p=147025. In
E> brief, it sounds like wxGetenv("TMPDIR") returns "." rather than an
E> empty string when TMPDIR is not defined in the system.

This would be really strange. It seems much more likely that something
does set TMPDIR to ".".

E> Does this issue known ? Does wxWidgets 2.9.4 solved something
E> about this ?

No and no. But I think the issue is really something in your program.

Regards,
VZ

Manolo

unread,
Sep 28, 2012, 4:52:25 PM9/28/12
to wx-...@googlegroups.com
El 28/09/12 22:28, Vadim Zeitlin escribi�:
wx2.9.4 changed filename.cpp. But I think it's still broken:
Take a look at SVN src/common/filename.cpp :: 645
I think there's a typo here:
- DWORD ret = ::GetFileAttributes(path.t_str());
+ DWORD ret = ::GetFileAttributes(strPath.t_str());

Regards,
Manolo

Vadim Zeitlin

unread,
Sep 28, 2012, 6:37:11 PM9/28/12
to wx-...@googlegroups.com
On Fri, 28 Sep 2012 22:52:25 +0200 Manolo wrote:

M> El 28/09/12 22:28, Vadim Zeitlin escribió:
M> > On Fri, 28 Sep 2012 21:20:24 +0200 Eric wrote:
M> >
M> > E> http://forums.wxwidgets.org/viewtopic.php?f=23&t=35907&p=147025. In
M> > E> brief, it sounds like wxGetenv("TMPDIR") returns "." rather than an
M> > E> empty string when TMPDIR is not defined in the system.
M> >
M> > This would be really strange. It seems much more likely that something
M> > does set TMPDIR to ".".
M> >
M> > E> Does this issue known ? Does wxWidgets 2.9.4 solved something
M> > E> about this ?
M> >
M> > No and no. But I think the issue is really something in your program.
M>
M> wx2.9.4 changed filename.cpp. But I think it's still broken:
M> Take a look at SVN src/common/filename.cpp :: 645
M> I think there's a typo here:
M> - DWORD ret = ::GetFileAttributes(path.t_str());
M> + DWORD ret = ::GetFileAttributes(strPath.t_str());

Thanks, I agree this is a bug and will fix this soon but I don't see how
can it explain wxGetenv("TMPDIR") returning "."...

Regards,
VZ

Manolo

unread,
Sep 28, 2012, 7:18:27 PM9/28/12
to wx-...@googlegroups.com
>
> Thanks, I agree this is a bug and will fix this soon but I don't see how
> can it explain wxGetenv("TMPDIR") returning "."...
>

I agree. The OP told that sometimes works and sometimes it does not.
I suspect the OP did a wrong set for TMPDIR in Code:Blocks.

Regards,
Manolo

Eric

unread,
Sep 29, 2012, 7:14:18 AM9/29/12
to wx-...@googlegroups.com
At 00:37 29/09/2012, you wrote:
>On Fri, 28 Sep 2012 22:52:25 +0200 Manolo wrote:
>
>M> El 28/09/12 22:28, Vadim Zeitlin escribió:
>M> > On Fri, 28 Sep 2012 21:20:24 +0200 Eric wrote:
>M> >
>M> > E> http://forums.wxwidgets.org/viewtopic.php?f=23&t=35907&p=147025. In
>M> > E> brief, it sounds like wxGetenv("TMPDIR") returns "." rather than an
>M> > E> empty string when TMPDIR is not defined in the system.
>M> >
>M> > This would be really strange. It seems much more likely that something
>M> > does set TMPDIR to ".".
>M>
>M> wx2.9.4 changed filename.cpp. But I think it's still broken:
>M> Take a look at SVN src/common/filename.cpp :: 645
>M> I think there's a typo here:
>M> - DWORD ret = ::GetFileAttributes(path.t_str());
>M> + DWORD ret = ::GetFileAttributes(strPath.t_str());
>
>VZ> Thanks, I agree this is a bug and will fix this soon but I don't see how
>VZ> can it explain wxGetenv("TMPDIR") returning "."

As said in the forum thread, it's a random
behavior (sometime "." and sometime right). So,
effectively, it goes more toward a way it's
dependent of something in my own system... My
question was to be sure that nothing was known
about this in wxWidgets. If I succeed to define
what's wrong on my side at a time or another,
I'll report-it in the forum rather than here ;
not to pollute the list. Thanks for you replies, Vadim and Manolo.

Reply all
Reply to author
Forward
0 new messages