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


Ignore:
Timestamp:
Apr 6, 2008, 8:07:40 PM (16 years ago)
Author:
dai_9181
Message:

構成管理を大幅に改良。

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

Legend:

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

    r205 r477  
    3737        return appDir;
    3838    }
     39
     40    static const std::string &GetAppFileName()
     41    {
     42        static std::string appFileName;
     43        if( appFileName.size() == 0 )
     44        {
     45            char temporary[MAX_PATH];
     46            char temp2[MAX_PATH];
     47            char temp3[MAX_PATH];
     48            GetModuleFileName(GetModuleHandle(0),temporary,MAX_PATH);
     49            _splitpath(temporary,NULL,NULL,temp2,temp3);
     50            lstrcat(temp2,temp3);
     51
     52            appFileName = temp2;
     53        }
     54        return appFileName;
     55    }
     56
     57    static const std::string &GetAppFilePath()
     58    {
     59        static std::string appFilePath;
     60        if( appFilePath.size() == 0 )
     61        {
     62            char temporary[MAX_PATH];
     63            GetModuleFileName(GetModuleHandle(0),temporary,MAX_PATH);
     64
     65            appFilePath = temporary;
     66        }
     67        return appFilePath;
     68    }
    3969};
    4070
  • trunk/ab5.0/jenga/src/common/Path.cpp

    r467 r477  
    5050    }
    5151
    52     i3=(int)baseDirPath.size();i4=0;
     52    std::string tempBaseDirPath = baseDirPath;
     53    if( tempBaseDirPath[tempBaseDirPath.size()-1] != '\\' )
     54    {
     55        tempBaseDirPath += "\\";
     56    }
     57
     58    i3=(int)tempBaseDirPath.size();i4=0;
    5359    while(i4<i2){
    5460        for(i3--;;i3--){
    55             if(baseDirPath[i3-1]=='\\'){
     61            if(tempBaseDirPath[i3-1]=='\\'){
    5662                i4++;
    5763                break;
     
    5965        }
    6066    }
    61     memcpy(temporary,baseDirPath.c_str(),i3);
     67    memcpy(temporary,tempBaseDirPath.c_str(),i3);
    6268    temporary[i3]=0;
    6369    lstrcat(temporary,resultPath+i);
    6470    lstrcpy(resultPath,temporary);
    6571
     72    if( resultPath[lstrlen(resultPath)-1] == '\\' )
     73    {
     74        resultPath[lstrlen(resultPath)-1] = 0;
     75    }
     76
    6677    return resultPath;
    6778}
Note: See TracChangeset for help on using the changeset viewer.