Changeset 467 in dev for trunk/ab5.0/jenga


Ignore:
Timestamp:
Mar 27, 2008, 2:29:35 AM (16 years ago)
Author:
dai_9181
Message:

いくつかのグローバル変数をProgram/Debuggerクラスにまとめた。

Location:
trunk/ab5.0/jenga
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/jenga/include/common/Path.h

    r314 r467  
    6262        return fullPath;
    6363    }
     64
     65    static std::string MakeFullPath( const std::string &relativePath, const std::string &baseDirPath );
    6466};
    6567
  • trunk/ab5.0/jenga/src/common/Path.cpp

    r314 r467  
    2222    return false;
    2323}
     24
     25std::string Jenga::Common::Path::MakeFullPath( const std::string &relativePath, const std::string &baseDirPath )
     26{
     27    int i,i2,i3,i4;
     28    char temporary[MAX_PATH];
     29
     30    char resultPath[MAX_PATH];
     31    lstrcpy( resultPath, relativePath.c_str() );
     32
     33    // '/'→'\'
     34    for( i=0;resultPath[i];i++ ){
     35        if( resultPath[i] == '/' ){
     36            resultPath[i]='\\';
     37        }
     38    }
     39
     40    if(strstr(resultPath,":")||strstr(resultPath,"\\\\")) return resultPath;
     41
     42    i=0;i2=0;
     43    while(1){
     44        if(resultPath[i]=='.'&&resultPath[i+1]=='\\') i+=2;
     45        if(resultPath[i]=='.'&&resultPath[i+1]=='.'&&resultPath[i+2]=='\\'){
     46            i2++;
     47            i+=3;
     48        }
     49        else break;
     50    }
     51
     52    i3=(int)baseDirPath.size();i4=0;
     53    while(i4<i2){
     54        for(i3--;;i3--){
     55            if(baseDirPath[i3-1]=='\\'){
     56                i4++;
     57                break;
     58            }
     59        }
     60    }
     61    memcpy(temporary,baseDirPath.c_str(),i3);
     62    temporary[i3]=0;
     63    lstrcat(temporary,resultPath+i);
     64    lstrcpy(resultPath,temporary);
     65
     66    return resultPath;
     67}
Note: See TracChangeset for help on using the changeset viewer.