Changeset 80 in dev for ProjectEditor/FileOperation.cpp


Ignore:
Timestamp:
Mar 26, 2007, 6:33:06 AM (17 years ago)
Author:
dai_9181
Message:

TheText用のリソースを追加。
単語単位での検索を可能にした。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ProjectEditor/FileOperation.cpp

    r24 r80  
    172172}
    173173
    174 void RemoveDirectoryStrong(const char *dir_path){
     174void RemoveDirectoryStrong(const char *dirPath){
     175    char tempDirPath[MAX_PATH];
     176    lstrcpy( tempDirPath, dirPath );
     177
     178    if( tempDirPath[lstrlen(tempDirPath)-1] == '\\' ){
     179         tempDirPath[lstrlen(tempDirPath)-1] = 0;
     180    }
     181
    175182    HANDLE hFind;
    176183    WIN32_FIND_DATA wfd;
    177184    char temporary[MAX_PATH];
    178     sprintf(temporary,"%s*",dir_path);
     185    sprintf(temporary,"%s\\*",tempDirPath);
    179186
    180187    hFind=FindFirstFile(temporary,&wfd);
     
    184191                if(!(lstrcmp(wfd.cFileName,".")==0||lstrcmp(wfd.cFileName,"..")==0)){
    185192                    //ディレクトリのとき
    186                     sprintf(temporary,"%s%s\\",dir_path,wfd.cFileName);
     193                    sprintf(temporary,"%s\\%s\\",tempDirPath,wfd.cFileName);
    187194                    RemoveDirectoryStrong(temporary);
    188195                }
     
    190197            else{
    191198                //ファイルのとき
    192                 sprintf(temporary,"%s%s",dir_path,wfd.cFileName);
     199                sprintf(temporary,"%s\\%s",tempDirPath,wfd.cFileName);
    193200
    194201                DeleteFile(temporary);
    195202            }
    196203        }while(FindNextFile(hFind,&wfd));
    197     }
    198 
    199     RemoveDirectory(dir_path);
     204
     205        FindClose( hFind );
     206    }
     207
     208    if( !RemoveDirectory(tempDirPath) ){
     209        OutputDebugString( GetLastErrorString().c_str() );
     210        OutputDebugString( "\r\n" );
     211        OutputDebugString( "一時ディレクトリの削除に失敗\r\n" );
     212    }
    200213}
    201214
Note: See TracChangeset for help on using the changeset viewer.