User forums > Using Code::Blocks

wxFileName alters directory names to make an invalid path

(1/1)

spflanze:
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 );

--- End code ---
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
--- End code ---
What I got instead was this:

--- Code: ---C:\ENGINE~1\TIADES~2\bin\Debug\TIA_Designer_Design_Data
--- End code ---
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?

stahta01:
Lookup "GetLongPath" and I suggest asking your wxWidgets programming questions on https://forums.wxwidgets.org/.

Tim S.

Navigation

[0] Message Index

Go to full version