Changeset 210

Show
Ignore:
Timestamp:
04/16/2006 06:24:44 PM
Author:
ldavis
Message:

Modified looking just for uppercase/lowercase extension to looking for
uppercase/lowercase leaf. This accounts for all my leaves, instead of
most of them.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/ssphys/SSPhysLib/SSItemInfoObject.cpp

    r208 r210  
    163163  boost::filesystem::path fpath(fileName, boost::filesystem::native); 
    164164 
    165   if (!boost::filesystem::exists(fpath)) 
    166   { 
    167     std::string lcExt(fileName); 
    168     lcExt[lcExt.length()-1] = tolower(lcExt[lcExt.length()-1]); 
    169     boost::filesystem::path lcpath(lcExt); 
    170     if (boost::filesystem::exists(lcpath)) 
     165  if (!boost::filesystem::exists(fpath) && fpath.has_leaf() && fpath.has_branch_path()) 
     166  { 
     167    std::string lcLeaf = fpath.leaf(); 
     168    std::string ucLeaf = fpath.leaf(); 
     169    for (int i = 0; i < lcLeaf.length(); ++i) { 
     170        lcLeaf[i] = tolower(lcLeaf[i]); 
     171        ucLeaf[i] = toupper(ucLeaf[i]); 
     172    } 
     173 
     174    boost::filesystem::path ucPath = fpath.branch_path() / ucLeaf; 
     175    boost::filesystem::path lcPath = fpath.branch_path() / lcLeaf; 
     176    if (boost::filesystem::exists(lcPath)) 
    171177    { 
    172       fileName = lcExt; 
     178        fileName = lcPath.string(); 
     179    } 
     180    else if (boost::filesystem::exists(ucPath)) 
     181    { 
     182        fileName = ucPath.string(); 
    173183    } 
    174184  } 

PumaCode.org recommends CVSDude for fast, professional Subversion and Trac hosting:

CVSDude.com

These ads are automatically generated by Google. Revenue from these ads helps to pay for hosting this site; however, these ads do not constitute an endorsement by PumaCode.org.