Discussion:
[wtl] extra long filenames and WTL
umeca74@hotmail.com [wtl]
2016-10-16 10:09:38 UTC
Permalink
with extra long filenames becoming a reality there needs to be some dusting off with WTL headers that specify MAX_PATH constant. Instead of fixed buffers we'd better off using CStrings everywhere. See here


www.zabkat.com/blog/long-8.3-path-names.htm http://www.zabkat.com/blog/long-8.3-path-names.htm
Thomas Hruska thruska@cubiclesoft.com [wtl]
2016-10-16 21:29:05 UTC
Permalink
Post by ***@hotmail.com [wtl]
with extra long filenames becoming a reality there needs to be some dusting off with WTL headers that specify MAX_PATH constant. Instead of fixed buffers we'd better off using CStrings everywhere. See here
www.zabkat.com/blog/long-8.3-path-names.htm http://www.zabkat.com/blog/long-8.3-path-names.htm
LFN is not really that hard to support.

https://github.com/cubiclesoft/cross-platform-cpp/blob/master/utf8/utf8_file_dir.cpp

I used static 8KB buffers there, which, even at 5 bytes per Unicode code
point (worst case scenario), is still 6.3 times more storage space than
the 260 byte limit. Very few people (if any) are going to hit the wall
at that limit. Stack space is cheap and fast - it's just a pointer move
on Intel chips which doesn't increase executable size - and you get 1MB
of stack space to play with per thread on Windows. The only issue here
to be concerned with is overflowing the stack, which going the full 32KB
could run a risk of if something calls too deeply. I've personally hit
the MAX_PATH 260 byte limit a couple of times but I've never even come
close to hitting my 8KB limit.
--
Thomas Hruska
CubicleSoft President

I've got great, time saving software that you will find useful.

http://cubiclesoft.com/
umeca74@hotmail.com [wtl]
2016-10-17 08:07:23 UTC
Permalink
to be strictly correct you'd need to replace MAX_PATH with 32768 which is the new limit. Or use CString
nenad2001@gmail.com [wtl]
2016-10-17 00:05:05 UTC
Permalink
Thanks! I added a new feature request "#97 Add support for long filenames" to track this.

Cheers,
Nenad
'Konstantin Mironovich' const@ixbt.com [wtl]
2016-11-01 10:50:21 UTC
Permalink
Hi,
personally I use CString.
but I thing using CHeapPtr<TCHAR> is more preferable. CHeapPtr class is more
simple than CString and has less dependencies.
the code looks like
CHeapPtr<TCHAR> buf;
DWORD len = _MAX_PATH;
do { buf.Reallocate(len); ... } while ( ... )


-km

----- Original Message -----
From: ***@hotmail.com [wtl]
To: ***@yahoogroups.com
Sent: Sunday, October 16, 2016 1:09 PM
Subject: [wtl] extra long filenames and WTL




with extra long filenames becoming a reality there needs to be some
dusting off with WTL headers that specify MAX_PATH constant. Instead of
fixed buffers we'd better off using CStrings everywhere. See here



www.zabkat.com/blog/long-8.3-path-names.htm
umeca74@hotmail.com [wtl]
2017-01-08 17:24:49 UTC
Permalink
another little trivia: some WTL buffers use _MAX_FNAME(=256) which is the maximum individual file/folder name limit, but this should be +1 for the terminating null. Or simply, forget about it and use MAX_PATH everywhere which is just 4 chars longer (and inclusive of NUL). For more information see
xplorer² blog: to MAX_PATH and beyond (programmer's deep path cookbook) http://zabkat.com/blog/max-path-programmers-cookbook.htm



xplorer² blog: to MAX_PATH and beyond (programmer's deep path cookbook) http://zabkat.com/blog/max-path-programmers-cookbook.htm As we still wait for windows Explorer and Shell to work in folders with very long path names (>=260 characters), here are some tips to make your programs long path ready (like xplorer² does it)



View on zabkat.com http://zabkat.com/blog/max-path-programmers-cookbook.htm
Preview by Yahoo

Loading...