Path: Add missing else clause on version statement
This was wrong on many level:
- The missing `else` clause meant that the `enforce` clause was always there on Windows;
- The `enforce("Reason")` should have been `enforce(false, "Reason")`,
  as in its current form it would never fail and not serve its intended purpose;
- It was pushing at runtime something that was easily detected at CT;
1 parent dc75f07 commit a6bfe6e336836c0483c7cdae89395673fa535a61
@Geod24 Geod24 authored on 27 Oct 2022
Mathias LANG committed on 27 Oct 2022
Showing 1 changed file
View
4
source/dub/internal/vibecompat/inet/path.d
version(Posix) { if(absolute) ret.put('/'); }
 
foreach( i, f; m_nodes ){
version(Windows) { if( i > 0 ) ret.put('\\'); }
version(Posix) { if( i > 0 ) ret.put('/'); }
else { enforce("Unsupported OS"); }
else version(Posix) { if( i > 0 ) ret.put('/'); }
else { static assert(0, "Unsupported OS"); }
ret.put(f.toString());
}
 
if( m_nodes.length > 0 && m_endsWithSlash ){