Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: spflanze on January 05, 2018, 06:31:24 am

Title: wxFileName alters directory names to make an invalid path
Post by: spflanze 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?

Title: Re: wxFileName alters directory names to make an invalid path
Post by: stahta01 on January 05, 2018, 07:31:41 am
Lookup "GetLongPath" and I suggest asking your wxWidgets programming questions on https://forums.wxwidgets.org/ (https://forums.wxwidgets.org/).

Tim S.