Menu

#1294 Replace hardcoded separators with wxPATH_SEP/wxFILE_SEP_PATH

Undefined
open
nobody
None
Bug_Report
2022-08-19
2022-08-05
No

While looking to the source code, I noticed into several sources these lines:

wxString sep = platform::windows ? _T(";") : _T(":");
wxChar pathSep = platform::windows ? _T('\') : _T('/');

or expressions like:

&& ((masterPath.Last() == '\') || (masterPath.Last() == '/')) )

Would it be correct to simplify a bit that code by using macros wxPATH_SEP and wxFILE_SEP_PATH?

Sincerely,

Carlo Bramini.

Discussion

  • Carlo Bramini

    Carlo Bramini - 2022-08-05

    Excuse me, I accidentally pressed the Post button before finishing the ticket and formatting the code lines. The right title in my mind was "Replace hardcoded separators with wxPATH_SEP/wxFILE_SEP_PATH".

     
  • Miguel Gimenez

    Miguel Gimenez - 2022-08-05
    • summary: Replace hardcoded separators with --> Replace hardcoded separators with wxPATH_SEP/wxFILE_SEP_PATH
     
  • Morten MacFly

    Morten MacFly - 2022-08-19

    Please be super-careful here, simple replacing this:
    && ((masterPath.Last() == '\') || (masterPath.Last() == '/')) )
    ...is dangerous because for example we "Unix-encode" paths in project files for good reasons also on Windows. So such a change must be done with special extra-care!

    This one could be replaced though:

    wxString sep = platform::windows ? _T(";") : _T(":");
    wxChar pathSep = platform::windows ? _T('\') : _T('/');
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.