continue phasing out SLASH
This commit is contained in:
@@ -889,20 +889,20 @@ CString Basename( const CString &dir )
|
|||||||
CString Dirname( const CString &dir )
|
CString Dirname( const CString &dir )
|
||||||
{
|
{
|
||||||
/* Special case: "/" -> "/". */
|
/* Special case: "/" -> "/". */
|
||||||
if( dir.size() == 1 && dir[0] == SLASH[0] )
|
if( dir.size() == 1 && dir[0] == '/' )
|
||||||
return SLASH;
|
return "/";
|
||||||
|
|
||||||
int pos = dir.size()-1;
|
int pos = dir.size()-1;
|
||||||
/* Skip trailing slashes. */
|
/* Skip trailing slashes. */
|
||||||
while( pos >= 0 && dir[pos] == SLASH[0] )
|
while( pos >= 0 && dir[pos] == '/' )
|
||||||
--pos;
|
--pos;
|
||||||
|
|
||||||
/* Skip the last component. */
|
/* Skip the last component. */
|
||||||
while( pos >= 0 && dir[pos] != SLASH[0] )
|
while( pos >= 0 && dir[pos] != '/' )
|
||||||
--pos;
|
--pos;
|
||||||
|
|
||||||
if( pos < 0 )
|
if( pos < 0 )
|
||||||
return "." SLASH;
|
return "./";
|
||||||
|
|
||||||
return dir.substr(0, pos+1);
|
return dir.substr(0, pos+1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ int FileSet::GetFileHash(const CString &path) const
|
|||||||
static void SplitPath( CString Path, CString &Dir, CString &Name )
|
static void SplitPath( CString Path, CString &Dir, CString &Name )
|
||||||
{
|
{
|
||||||
/* Strip off any trailing slashes. */
|
/* Strip off any trailing slashes. */
|
||||||
if( Path.size() > 0 && Path.Right(1) == SLASH )
|
if( Path.size() > 0 && Path.Right(1) == "/" )
|
||||||
Path.erase( Path.size()-1 );
|
Path.erase( Path.size()-1 );
|
||||||
|
|
||||||
static Regex split("(.*/)([^/]+)");
|
static Regex split("(.*/)([^/]+)");
|
||||||
@@ -93,7 +93,7 @@ static void SplitPath( CString Path, CString &Dir, CString &Name )
|
|||||||
Name = match[1];
|
Name = match[1];
|
||||||
} else {
|
} else {
|
||||||
/* No slash. */
|
/* No slash. */
|
||||||
Dir = "." SLASH;
|
Dir = "./";
|
||||||
Name = Path;
|
Name = Path;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,10 +133,10 @@ bool FilenameDB::ResolvePath(CString &path)
|
|||||||
|
|
||||||
/* Split path into components. */
|
/* Split path into components. */
|
||||||
vector<CString> p;
|
vector<CString> p;
|
||||||
split(path, SLASH, p, true);
|
split(path, "/", p, true);
|
||||||
|
|
||||||
/* If we have "/foo", then add a blank entry to the beginning to line things up. */
|
/* If we have "/foo", then add a blank entry to the beginning to line things up. */
|
||||||
if( path.Left( strlen(SLASH) ) == SLASH )
|
if( path.Left(1) == "/" )
|
||||||
p.insert( p.begin(), "" );
|
p.insert( p.begin(), "" );
|
||||||
|
|
||||||
/* Resolve each component. Assume the first component is correct. XXX
|
/* Resolve each component. Assume the first component is correct. XXX
|
||||||
@@ -144,7 +144,7 @@ bool FilenameDB::ResolvePath(CString &path)
|
|||||||
CString ret = p[0];
|
CString ret = p[0];
|
||||||
for(unsigned i = 1; i < p.size(); ++i)
|
for(unsigned i = 1; i < p.size(); ++i)
|
||||||
{
|
{
|
||||||
ret += SLASH;
|
ret += "/";
|
||||||
|
|
||||||
vector<CString> lst;
|
vector<CString> lst;
|
||||||
FileSet &fs = GetFileSet( ret );
|
FileSet &fs = GetFileSet( ret );
|
||||||
@@ -160,8 +160,8 @@ bool FilenameDB::ResolvePath(CString &path)
|
|||||||
ret += lst[0];
|
ret += lst[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
if(path.Right(1) == SLASH)
|
if(path.Right(1) == "/")
|
||||||
path = ret + SLASH;
|
path = ret + "/";
|
||||||
else
|
else
|
||||||
path = ret;
|
path = ret;
|
||||||
return true;
|
return true;
|
||||||
@@ -208,8 +208,8 @@ void FilenameDB::GetFilesSimpleMatch(const CString &dir, const CString &fn, vect
|
|||||||
FileSet &FilenameDB::GetFileSet( CString dir )
|
FileSet &FilenameDB::GetFileSet( CString dir )
|
||||||
{
|
{
|
||||||
/* Normalize the path. */
|
/* Normalize the path. */
|
||||||
dir.Replace("\\", SLASH); /* foo\bar -> foo/bar */
|
dir.Replace("\\", "/"); /* foo\bar -> foo/bar */
|
||||||
dir.Replace("//", SLASH); /* foo//bar -> foo/bar */
|
dir.Replace("//", "/"); /* foo//bar -> foo/bar */
|
||||||
|
|
||||||
CString lower = dir;
|
CString lower = dir;
|
||||||
lower.MakeLower();
|
lower.MakeLower();
|
||||||
@@ -323,7 +323,7 @@ void FilenameDB::GetDirListing( CString sPath, CStringArray &AddTo, bool bOnlyDi
|
|||||||
* prepend "./" */
|
* prepend "./" */
|
||||||
|
|
||||||
/* Strip off the last path element and use it as a mask. */
|
/* Strip off the last path element and use it as a mask. */
|
||||||
unsigned pos = sPath.find_last_of( SLASH );
|
unsigned pos = sPath.find_last_of( '/' );
|
||||||
CString fn;
|
CString fn;
|
||||||
if(pos != sPath.npos)
|
if(pos != sPath.npos)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user