108 if( aPath.IsEmpty() )
112 if( aPath.find( wxUniChar( 0 ) ) != wxString::npos )
116 wxString
name = aPath;
117 name.Replace( wxT(
"\\" ), wxT(
"/" ) );
120 if(
name.StartsWith( wxT(
"/" ) ) )
125 wxFileName::SplitVolume(
name, &volume,
nullptr, wxPATH_DOS );
127 if( !volume.IsEmpty() )
130 for(
const wxString& part : wxSplit(
name,
'/', (wxChar) 0 ) )
133 if( part.IsEmpty() || part == wxT(
"." ) )
136 if( part == wxT(
".." ) )
141 if( part.Contains( wxT(
":" ) ) || part.EndsWith( wxT(
"." ) ) || part.EndsWith( wxT(
" " ) ) )
150 return !aParts.IsEmpty();
175 wxFileName dest = wxFileName::DirName( aDestDir );
178 dest.Normalize( wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE );
180 wxFileName target = dest;
182 for(
size_t ii = 0; ii + 1 < parts.GetCount(); ++ii )
183 target.AppendDir( parts[ii] );
185 target.SetFullName( parts.Last() );
186 target.Normalize( wxPATH_NORM_DOTS | wxPATH_NORM_ABSOLUTE );
189 const wxString destPath = dest.GetPathWithSep();
190 const wxString fullPath = target.GetFullPath();
192 if( fullPath.length() <= destPath.length() )
195 if( wxFileName::IsCaseSensitive() )
197 if( !fullPath.StartsWith( destPath ) )
200 else if( !fullPath.Lower().StartsWith( destPath.Lower() ) )
static bool ResolveArchiveEntryPath(const wxString &aDestDir, const wxString &aEntryName, wxFileName &aResult)
Resolve an untrusted archive entry name against the directory it is extracted into.