Author Topic: wxFileName alters directory names to make an invalid path  (Read 4463 times)

Offline spflanze

  • Almost regular
  • **
  • Posts: 134
wxFileName alters directory names to make an invalid path
« on: January 05, 2018, 06:31:24 am »
In this code:
Code
wxString globalFilename( "TIA_Designer_Design_Data" );
wxFileName fname( wxTheApp->argv[0] );
wxString DataFileStr =  fname.GetPath(wxPATH_GET_VOLUME|wxPATH_GET_SEPARATOR) + globalFilename;
m_DataFile = new wxFileConfig( "", "", DataFileStr );
I expected DataFileStr to have a filepath to the same directory the application is running in, and a filename of "TIA_Designer_Design_Data". This then is the path I expected:
Code
C:\Engineering Software\TIA Designer\bin\Debug\TIA_Designer_Design_Data
What I got instead was this:
Code
C:\ENGINE~1\TIADES~2\bin\Debug\TIA_Designer_Design_Data
There is no sign the wxConfigFile object created a file anywhere on hard drive C. Why are the first two directories in the path other than "Engineering Software\TIA Designer"? Why are these directory names being truncated, capitalized, and tilde characters followed by a number appended? Is it because there are spaces in the directory names?


Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
Re: wxFileName alters directory names to make an invalid path
« Reply #1 on: January 05, 2018, 07:31:41 am »
Lookup "GetLongPath" and I suggest asking your wxWidgets programming questions on https://forums.wxwidgets.org/.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org