removes first path part from pathname and returns it
| 3527 | |
| 3528 | /// removes first path part from pathname and returns it |
| 3529 | lString16 LVExtractFirstPathElement( lString16 & pathName ) |
| 3530 | { |
| 3531 | if ( pathName.empty() ) |
| 3532 | return lString16(); |
| 3533 | if ( pathName[0]=='/' || pathName[0]=='\\' ) |
| 3534 | pathName.erase(0, 1); |
| 3535 | int first_delim_pos = -1; |
| 3536 | for ( unsigned i=0; i<pathName.length(); i++ ) |
| 3537 | if ( pathName[i]=='/' || pathName[i]=='\\' ) { |
| 3538 | first_delim_pos = i; |
| 3539 | break; |
| 3540 | } |
| 3541 | if ( first_delim_pos==-1 ) { |
| 3542 | lString16 res = pathName; |
| 3543 | pathName.clear(); |
| 3544 | return res; |
| 3545 | } |
| 3546 | lString16 res = pathName.substr(0, first_delim_pos ); |
| 3547 | pathName.erase(0, first_delim_pos+1 ); |
| 3548 | return res; |
| 3549 | } |
| 3550 | |
| 3551 | /// appends path delimiter character to end of path, if absent |
| 3552 | void LVAppendPathDelimiter( lString16 & pathName ) |