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

Offline spflanze

  • Multiple posting newcomer
  • *
  • Posts: 33
wxFileName alters directory names to make an invalid path
« on: January 05, 2018, 06:31:24 am »
In this code:
Code: [Select]
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: [Select]
C:\Engineering Software\TIA Designer\bin\Debug\TIA_Designer_Design_DataWhat I got instead was this:
Code: [Select]
C:\ENGINE~1\TIADES~2\bin\Debug\TIA_Designer_Design_DataThere 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: 6154
    • 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 32 bit.
On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org