Handling Long Paths in wxWidgets

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
RedStreak
In need of some credit
In need of some credit
Posts: 9
Joined: Fri Mar 30, 2018 4:58 pm

Handling Long Paths in wxWidgets

Post by RedStreak » Sun Oct 11, 2020 2:18 pm

Hi devs,

I have a use case that requires that my application handles long path names ( over 260 chars ). Currently building against 3.1.4 Unicode and testing this on Windows 10. Pre-pending the usual Win32 prefix "\\?\" does not seem to work.

Here is a code snippet:

Code: Select all

wxString Path = "........";
wxString LongPath = "\\\\?\\" + Path;

wxFFileOutputStream* m_pOut = new wxFFileOutputStream(LongPath);

if (!m_pOut->IsOk())
{
   return false;
}
m_pOut above fails for long paths but passes for shorter paths. I know internally wxFFileOutputStream uses wxFFile to open the file using the CRT wrapper function wxFopen.

This is the first time I'm dealing with long paths in wx, anyone with ideas for how to get around this? Or just maybe something I'm missing.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 4543
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: Handling Long Paths in wxWidgets

Post by ONEEYEMAN » Sun Oct 11, 2020 9:40 pm

Hi,
Can you provide some sample path?
Can wx program create such a path?
Also - what do you mean by "fail for a long path"? Crash?? Nothing happened? Wrong result?

Thank you.

Post Reply